Skip to content
Open
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
17 changes: 17 additions & 0 deletions lib/algora_web/live/orgs_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ defmodule AlgoraWeb.OrgsLive do
<span class="line-clamp-3 pt-2 text-xs text-gray-300 sm:text-sm">
{org.bio}
</span>

<div
:if={display_tech_stack(org.tech_stack) != []}
class="flex flex-wrap items-center justify-center gap-1.5 pt-3"
>
<%= for tech <- display_tech_stack(org.tech_stack) do %>
<.tech_badge tech={tech} size="sm" />
<% end %>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -137,4 +146,12 @@ defmodule AlgoraWeb.OrgsLive do
end

defp page_size, do: 9

defp display_tech_stack(tech_stack) do
tech_stack
|> List.wrap()
|> Enum.map(&String.trim/1)
|> Enum.reject(&(&1 == ""))
|> Enum.take(4)
end
end
32 changes: 32 additions & 0 deletions test/algora_web/live/orgs_live_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
defmodule AlgoraWeb.OrgsLiveTest do
use AlgoraWeb.ConnCase, async: false

import Algora.Factory
import Phoenix.LiveViewTest

test "renders project technology tags", %{conn: conn} do
user = insert(:user)

org =
insert(:organization,
display_name: "Golem Cloud",
handle: "golem-cloud",
featured: true,
tech_stack: ["Rust", "TypeScript"],
bio: "Build and deploy durable workers"
)

insert(:transaction, user: org, net_amount: Money.new(1000, :USD), type: :debit, status: :succeeded)

conn =
conn
|> Phoenix.ConnTest.init_test_session(%{})
|> AlgoraWeb.UserAuth.put_current_user(user)

{:ok, _view, html} = live(conn, ~p"/projects")

assert html =~ "Golem Cloud"
assert html =~ "Rust"
assert html =~ "TypeScript"
end
end