Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ Algora combines:
</tr>
<tr>
<td align="center">
<img src="https://app.algora.io/og/org/cal/home" alt="Homepage" width="250">
<img src="https://app.algora.io/og/cal/home" alt="Homepage" width="250">
</td>
<td align="center">
<img src="https://app.algora.io/og/org/zio/leaderboard" alt="Homepage" width="250">
<img src="https://app.algora.io/og/zio/leaderboard" alt="Homepage" width="250">
</td>
</tr>
</table>
Expand Down
4 changes: 3 additions & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ config :algora,
{"/podcast", "https://www.youtube.com/@algora-io/podcasts"},
{"/create/org", "/onboarding/org"},
{"/solve", "/onboarding/dev"},
{"/onboarding/solver", "/onboarding/dev"}
{"/onboarding/solver", "/onboarding/dev"},
{"/org/*path", "/*path"},
{"/@/:handle", "/:handle/profile"}
]

# Configures the endpoint
Expand Down
4 changes: 1 addition & 3 deletions lib/algora/accounts/schemas/user.ex
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,6 @@ defmodule Algora.Accounts.User do
def handle(%{handle: handle}) when is_binary(handle), do: handle
def handle(%{provider_login: handle}), do: handle

def url(%{handle: handle, type: :individual}) when is_binary(handle), do: "#{Endpoint.url()}/@/#{handle}"
def url(%{handle: handle, type: :organization}) when is_binary(handle), do: "#{Endpoint.url()}/org/#{handle}"
def url(%{handle: handle}) when is_binary(handle), do: "#{Endpoint.url()}/org/#{handle}"
def url(%{handle: handle}) when is_binary(handle), do: "#{Endpoint.url()}/#{handle}"
def url(%{provider_login: handle}), do: "https://github.com/#{handle}"
end
4 changes: 2 additions & 2 deletions lib/algora/activities/discord_views.ex
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ defmodule Algora.Activities.DiscordViews do
author: %{
name: tx.linked_transaction.user.name,
icon_url: tx.linked_transaction.user.avatar_url,
url: "#{AlgoraWeb.Endpoint.url()}/org/#{tx.linked_transaction.user.handle}"
url: "#{AlgoraWeb.Endpoint.url()}/#{tx.linked_transaction.user.handle}"
},
footer: %{
text: tx.user.name,
Expand All @@ -75,7 +75,7 @@ defmodule Algora.Activities.DiscordViews do
inline: false
}
],
url: "#{AlgoraWeb.Endpoint.url()}/org/#{tx.linked_transaction.user.handle}",
url: "#{AlgoraWeb.Endpoint.url()}/#{tx.linked_transaction.user.handle}",
timestamp: tx.succeeded_at
}
]
Expand Down
6 changes: 2 additions & 4 deletions lib/algora/activities/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ defmodule Algora.Activities.Router do
alias Algora.Accounts.Identity
alias Algora.Bounties.Bounty

def route(%{assoc: %Bounty{owner: user}}), do: {:ok, "/org/#{user.handle}/bounties"}
def route(%{assoc: %Bounty{owner: user}}), do: {:ok, "/#{user.handle}/bounties"}

def route(%{assoc: %Identity{user: %{type: :individual} = user}}), do: {:ok, "/@/#{user.handle}"}

def route(%{assoc: %Identity{user: %{type: :organization} = user}}), do: {:ok, "/org/#{user.handle}"}
def route(%{assoc: %Identity{user: user}}), do: {:ok, "/#{user.handle}"}

def route(_activity) do
{:error, :not_found}
Expand Down
2 changes: 1 addition & 1 deletion lib/algora/bot_templates/bot_templates.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defmodule Algora.BotTemplates do

def placeholders(:bounty_created, user) do
%{
"PRIZE_POOL" => "## 💎 $1,000 bounty [• #{user.name}](#{AlgoraWeb.Endpoint.url()}/@/#{user.handle})",
"PRIZE_POOL" => "## 💎 $1,000 bounty [• #{user.name}](#{AlgoraWeb.Endpoint.url()}/#{user.handle})",
"ISSUE_NUMBER" => "100",
"REPO_FULL_NAME" => "#{user.provider_login || user.handle}/repo",
"ATTEMPTS" => """
Expand Down
2 changes: 1 addition & 1 deletion lib/algora/integrations/discord/discord.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ defmodule Algora.Discord do
...> icon_url: "https://example.com/avatar.png",
...> url: "https://example.com/org"
...> },
...> url: "https://github.com/org/repo/issues/1",
...> url: "https://github.com/repo/issues/1",
...> timestamp: DateTime.utc_now() |> DateTime.to_iso8601()
...> }
...> ]
Expand Down
4 changes: 2 additions & 2 deletions lib/algora_web/controllers/api/og_redirect_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ defmodule AlgoraWeb.API.OGRedirectController do
target_path =
case {asset, params["status"]} do
{"leaderboard.png", _} ->
"/og/org/#{org_handle}/leaderboard"
"/og/#{org_handle}/leaderboard"

{"bounties.png", _} ->
"/og/org/#{org_handle}"
"/og/#{org_handle}"

_ ->
nil
Expand Down
2 changes: 1 addition & 1 deletion lib/algora_web/controllers/org_auth.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defmodule AlgoraWeb.OrgAuth do
if get_user_role(current_user, current_org) in allowed_roles do
{:cont, socket}
else
{:halt, redirect(socket, to: "/org/#{current_org.handle}")}
{:halt, redirect(socket, to: "/#{current_org.handle}")}
end
end
end
2 changes: 1 addition & 1 deletion lib/algora_web/controllers/user_auth.ex
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ defmodule AlgoraWeb.UserAuth do
end
end

def signed_in_path_from_context(org_handle), do: ~p"/org/#{org_handle}"
def signed_in_path_from_context(org_handle), do: ~p"/#{org_handle}"

def signed_in_path(%User{} = user) do
signed_in_path_from_context(Accounts.last_context(user))
Expand Down
25 changes: 25 additions & 0 deletions lib/algora_web/controllers/user_controller.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
defmodule AlgoraWeb.UserController do
use AlgoraWeb, :controller

alias Algora.Accounts.User
alias Algora.Repo

def index(conn, %{"handle" => handle}) do
user = Repo.get_by(User, handle: handle)

case user do
nil ->
# TODO: redirect to go page
raise AlgoraWeb.NotFoundError

%{type: :individual} ->
redirect(conn, to: "/#{handle}/profile")

%{type: :organization} ->
redirect(conn, to: "/#{handle}/dashboard")

_ ->
raise AlgoraWeb.NotFoundError
end
end
end
2 changes: 1 addition & 1 deletion lib/algora_web/live/bounty_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ defmodule AlgoraWeb.BountyLive do
~p"/#{socket.assigns.ticket_ref.owner}/#{socket.assigns.ticket_ref.repo}/issues/#{socket.assigns.ticket_ref.number}"
)
else
url(~p"/org/#{socket.assigns.bounty.owner.handle}/bounties/#{socket.assigns.bounty.id}")
url(~p"/#{socket.assigns.bounty.owner.handle}/bounties/#{socket.assigns.bounty.id}")
end

{:ok,
Expand Down
2 changes: 1 addition & 1 deletion lib/algora_web/live/contract/view_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ defmodule AlgoraWeb.Contract.ViewLive do

case socket.assigns[:current_user] do
nil ->
{:ok, redirect(socket, to: ~p"/auth/login?return_to=#{~p"/org/#{contract.client.handle}/contracts/#{id}"}")}
{:ok, redirect(socket, to: ~p"/auth/login?return_to=#{~p"/#{contract.client.handle}/contracts/#{id}"}")}

current_user ->
if current_user.id != contract.contractor_id and
Expand Down
32 changes: 16 additions & 16 deletions lib/algora_web/live/crowdfund.ex
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ defmodule AlgoraWeb.CrowdfundLive do
</.link>

<.link
href={~p"/org/coollabsio"}
href={~p"/coollabsio"}
rel="noopener"
class="relative flex flex-col sm:flex-row items-start sm:items-center gap-4 sm:gap-x-4 rounded-xl bg-black p-4 sm:p-6 ring-1 ring-border transition-colors"
>
Expand Down Expand Up @@ -658,15 +658,15 @@ defmodule AlgoraWeb.CrowdfundLive do
<div class="grid grid-cols-3 lg:grid-cols-3 items-center justify-center gap-x-5 gap-y-4 sm:gap-x-12 sm:gap-y-12">
<.link
class="font-bold font-display text-base sm:text-4xl whitespace-nowrap flex items-center justify-center"
navigate={~p"/org/browser-use"}
navigate={~p"/browser-use"}
>
<img
class="size-4 sm:size-10 mr-2 sm:mr-4"
src={~p"/images/wordmarks/browser-use.svg"}
loading="lazy"
/> Browser Use
</.link>
<.link class="relative flex items-center justify-center" navigate={~p"/org/outerbase"}>
<.link class="relative flex items-center justify-center" navigate={~p"/outerbase"}>
<svg viewBox="0 0 123 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-[80%]">
<path
fill-rule="evenodd"
Expand Down Expand Up @@ -725,15 +725,15 @@ defmodule AlgoraWeb.CrowdfundLive do
</path>
</svg>
</.link>
<.link class="relative flex items-center justify-center" navigate={~p"/org/triggerdotdev"}>
<.link class="relative flex items-center justify-center" navigate={~p"/triggerdotdev"}>
<img
src={~p"/images/wordmarks/triggerdotdev.png"}
alt="Trigger.dev"
class="col-auto sm:w-[90%] saturate-0"
loading="lazy"
/>
</.link>
<.link class="relative flex items-center justify-center" navigate={~p"/org/traceloop"}>
<.link class="relative flex items-center justify-center" navigate={~p"/traceloop"}>
<img
src={~p"/images/wordmarks/traceloop.png"}
alt="Traceloop"
Expand All @@ -743,7 +743,7 @@ defmodule AlgoraWeb.CrowdfundLive do
</.link>
<.link
class="font-bold font-display text-base sm:text-5xl whitespace-nowrap flex items-center justify-center"
navigate={~p"/org/trieve"}
navigate={~p"/trieve"}
>
<img
src={~p"/images/wordmarks/trieve.png"}
Expand All @@ -754,7 +754,7 @@ defmodule AlgoraWeb.CrowdfundLive do
</.link>
<.link
class="font-bold font-display text-base sm:text-5xl whitespace-nowrap flex items-center justify-center"
navigate={~p"/org/twentyhq"}
navigate={~p"/twentyhq"}
>
<svg
xmlns="http://www.w3.org/2000/svg"
Expand All @@ -769,18 +769,18 @@ defmodule AlgoraWeb.CrowdfundLive do
</svg>
Twenty
</.link>
<.link class="relative flex items-center justify-center" navigate={~p"/org/aidenybai"}>
<.link class="relative flex items-center justify-center" navigate={~p"/aidenybai"}>
<img
src={~p"/images/wordmarks/million.png"}
alt="Million"
class="col-auto w-[80%] saturate-0"
loading="lazy"
/>
</.link>
<.link class="relative flex items-center justify-center" navigate={~p"/org/moonrepo"}>
<.link class="relative flex items-center justify-center" navigate={~p"/moonrepo"}>
<img src={~p"/images/wordmarks/moonrepo.svg"} alt="moon" class="w-[80%]" loading="lazy" />
</.link>
<.link class="relative flex items-center justify-center" navigate={~p"/org/dittofeed"}>
<.link class="relative flex items-center justify-center" navigate={~p"/dittofeed"}>
<img
src={~p"/images/wordmarks/dittofeed.png"}
alt="Dittofeed"
Expand All @@ -791,7 +791,7 @@ defmodule AlgoraWeb.CrowdfundLive do

<.link
class="relative flex items-center justify-center brightness-0 invert"
navigate={~p"/org/onyx-dot-app"}
navigate={~p"/onyx-dot-app"}
>
<img
src={~p"/images/wordmarks/onyx.png"}
Expand All @@ -804,13 +804,13 @@ defmodule AlgoraWeb.CrowdfundLive do
<.link
class="font-bold font-display text-base sm:text-4xl whitespace-nowrap flex items-center justify-center brightness-0 invert"
aria-label="Logo"
navigate={~p"/org/mendableai"}
navigate={~p"/mendableai"}
>
🔥
Firecrawl
</.link>

<.link class="relative flex items-center justify-center" navigate={~p"/org/keephq"}>
<.link class="relative flex items-center justify-center" navigate={~p"/keephq"}>
<img
src={~p"/images/wordmarks/keep.png"}
alt="Keep"
Expand All @@ -821,7 +821,7 @@ defmodule AlgoraWeb.CrowdfundLive do

<.link
class="font-bold font-display text-base sm:text-5xl whitespace-nowrap flex items-center justify-center"
navigate={~p"/org/windmill-labs"}
navigate={~p"/windmill-labs"}
>
<img
src={~p"/images/wordmarks/windmill.svg"}
Expand All @@ -831,7 +831,7 @@ defmodule AlgoraWeb.CrowdfundLive do
/> Windmill
</.link>

<.link class="relative flex items-center justify-center" navigate={~p"/org/panoratech"}>
<.link class="relative flex items-center justify-center" navigate={~p"/panoratech"}>
<img
src={~p"/images/wordmarks/panora.png"}
alt="Panora"
Expand All @@ -840,7 +840,7 @@ defmodule AlgoraWeb.CrowdfundLive do
/>
</.link>

<.link class="relative flex items-center justify-center" navigate={~p"/org/highlight"}>
<.link class="relative flex items-center justify-center" navigate={~p"/highlight"}>
<img
src={~p"/images/wordmarks/highlight.png"}
alt="Highlight"
Expand Down
48 changes: 26 additions & 22 deletions lib/algora_web/live/home_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ defmodule AlgoraWeb.HomeLive do
end

@impl true
def mount(%{"country_code" => country_code} = params, _session, socket) do
Gettext.put_locale(AlgoraWeb.Gettext, Algora.Util.locale_from_country_code(country_code))

def mount(params, _session, socket) do
total_contributors = get_contributors_count()
total_countries = get_countries_count()

Expand All @@ -54,27 +52,33 @@ defmodule AlgoraWeb.HomeLive do
%{label: "Countries", value: format_number(total_countries)}
]

featured_devs = Accounts.list_featured_developers(country_code)
featured_devs = Accounts.list_featured_developers()
featured_collabs = list_featured_collabs()

{:ok,
socket
|> assign(:page_title, "Algora - The open source Upwork for engineers")
|> assign(:page_image, "#{AlgoraWeb.Endpoint.url()}/images/og/home.png")
|> assign(:screenshot?, not is_nil(params["screenshot"]))
|> assign(:featured_devs, featured_devs)
|> assign(:featured_collabs, featured_collabs)
|> assign(:stats, stats)
|> assign(:bounty_form, to_form(BountyForm.changeset(%BountyForm{}, %{})))
|> assign(:contract_form, to_form(ContractForm.changeset(%ContractForm{}, %{})))
|> assign(:tip_form, to_form(TipForm.changeset(%TipForm{}, %{})))
|> assign(:repo_form, to_form(RepoForm.changeset(%RepoForm{}, %{})))
|> assign(:plans1, AlgoraWeb.PricingLive.get_plans1())
|> assign(:total_contributors, total_contributors)
|> assign(:total_countries, total_countries)
|> assign(:selected_developer, nil)
|> assign(:share_drawer_type, nil)
|> assign(:show_share_drawer, false)}
case socket.assigns[:current_user] do
nil ->
{:ok,
socket
|> assign(:page_title, "Algora - The open source Upwork for engineers")
|> assign(:page_image, "#{AlgoraWeb.Endpoint.url()}/images/og/home.png")
|> assign(:screenshot?, not is_nil(params["screenshot"]))
|> assign(:featured_devs, featured_devs)
|> assign(:featured_collabs, featured_collabs)
|> assign(:stats, stats)
|> assign(:bounty_form, to_form(BountyForm.changeset(%BountyForm{}, %{})))
|> assign(:contract_form, to_form(ContractForm.changeset(%ContractForm{}, %{})))
|> assign(:tip_form, to_form(TipForm.changeset(%TipForm{}, %{})))
|> assign(:repo_form, to_form(RepoForm.changeset(%RepoForm{}, %{})))
|> assign(:plans1, AlgoraWeb.PricingLive.get_plans1())
|> assign(:total_contributors, total_contributors)
|> assign(:total_countries, total_countries)
|> assign(:selected_developer, nil)
|> assign(:share_drawer_type, nil)
|> assign(:show_share_drawer, false)}

user ->
{:ok, redirect(socket, to: AlgoraWeb.UserAuth.signed_in_path(user))}
end
end

defp org_features do
Expand Down
Loading