Skip to content

Commit 1cf0c5a

Browse files
committed
misc improvements
1 parent 41fca0e commit 1cf0c5a

File tree

1 file changed

+68
-24
lines changed

1 file changed

+68
-24
lines changed

lib/algora_web/live/jobs_live.ex

Lines changed: 68 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,32 @@ defmodule AlgoraWeb.JobsLive do
7373
<%= for {user, jobs} <- @jobs_by_user do %>
7474
<.card class="flex flex-col p-6">
7575
<div class="flex items-center gap-4">
76-
<.avatar class="h-12 w-12">
76+
<.avatar class="h-16 w-16">
7777
<.avatar_image src={user.avatar_url} />
7878
<.avatar_fallback>
7979
{Algora.Util.initials(user.name)}
8080
</.avatar_fallback>
8181
</.avatar>
8282
<div>
83-
<div class="text-lg font-semibold">
83+
<div class="text-lg text-foreground font-bold font-display">
8484
{user.name}
8585
</div>
86-
<div class="text-sm text-muted-foreground">
86+
<div class="text-sm text-muted-foreground line-clamp-1">
8787
{user.bio}
8888
</div>
89+
<div class="flex gap-2 items-center">
90+
<%= for {platform, icon} <- social_icons(),
91+
url = social_link(user, platform),
92+
not is_nil(url) do %>
93+
<.link
94+
href={url}
95+
target="_blank"
96+
class="text-muted-foreground hover:text-foreground"
97+
>
98+
<.icon name={icon} class="size-4" />
99+
</.link>
100+
<% end %>
101+
</div>
89102
</div>
90103
</div>
91104
@@ -161,25 +174,48 @@ defmodule AlgoraWeb.JobsLive do
161174
<.input field={@form[:company_name]} label="Company Name" />
162175
</div>
163176
164-
<div class="flex justify-between">
177+
<div class="flex justify-between gap-4">
165178
<div>
166179
<div
167180
:if={
168181
@user_metadata.ok? && get_in(@user_metadata.result, [:org, :favicon_url])
169182
}
170-
class="flex items-center gap-4"
183+
class="flex items-center gap-3"
171184
>
172-
<img
173-
:if={get_in(@user_metadata.result, [:org, :favicon_url])}
174-
src={get_in(@user_metadata.result, [:org, :favicon_url])}
175-
class="h-12 w-12 rounded-full"
176-
/>
185+
<%= if logo = get_in(@user_metadata.result, [:org, :favicon_url]) do %>
186+
<img src={logo} class="h-16 w-16 rounded-2xl" />
187+
<% end %>
177188
<div>
178189
<div class="text-lg text-foreground font-bold font-display">
179190
{get_change(@form.source, :company_name)}
180191
</div>
181-
<div class="text-sm text-muted-foreground">
182-
{get_change(@form.source, :company_url)}
192+
<%= if description = get_in(@user_metadata.result, [:org, :og_description]) do %>
193+
<div class="text-sm text-muted-foreground line-clamp-1">
194+
{description}
195+
</div>
196+
<% end %>
197+
<div class="flex gap-2 items-center">
198+
<%= if url = get_change(@form.source, :company_url) do %>
199+
<.link
200+
href={url}
201+
target="_blank"
202+
class="text-muted-foreground hover:text-foreground"
203+
>
204+
<.icon name="tabler-world" class="size-4" />
205+
</.link>
206+
<% end %>
207+
208+
<%= for {platform, icon} <- social_icons(),
209+
url = get_in(@user_metadata.result, [:org, :socials, platform]),
210+
not is_nil(url) do %>
211+
<.link
212+
href={url}
213+
target="_blank"
214+
class="text-muted-foreground hover:text-foreground"
215+
>
216+
<.icon name={icon} class="size-4" />
217+
</.link>
218+
<% end %>
183219
</div>
184220
</div>
185221
</div>
@@ -266,18 +302,10 @@ defmodule AlgoraWeb.JobsLive do
266302

267303
@impl true
268304
def handle_async(:fetch_metadata, {:ok, metadata}, socket) do
269-
socket =
270-
case get_change(socket.assigns.form.source, :company_name) do
271-
nil ->
272-
assign(socket,
273-
form: to_form(change(socket.assigns.form.source, company_name: get_in(metadata, [:org, :og_title])))
274-
)
275-
276-
_company_name ->
277-
socket
278-
end
279-
280-
{:noreply, assign(socket, :user_metadata, AsyncResult.ok(socket.assigns.user_metadata, metadata))}
305+
{:noreply,
306+
socket
307+
|> assign(:user_metadata, AsyncResult.ok(socket.assigns.user_metadata, metadata))
308+
|> assign(:form, to_form(change(socket.assigns.form.source, company_name: get_in(metadata, [:org, :og_title]))))}
281309
end
282310

283311
@impl true
@@ -295,4 +323,20 @@ defmodule AlgoraWeb.JobsLive do
295323

296324
assign(socket, :user_applications, user_applications)
297325
end
326+
327+
defp social_icons do
328+
%{
329+
website: "tabler-world",
330+
github: "github",
331+
twitter: "tabler-brand-x",
332+
youtube: "tabler-brand-youtube",
333+
twitch: "tabler-brand-twitch",
334+
discord: "tabler-brand-discord",
335+
slack: "tabler-brand-slack",
336+
linkedin: "tabler-brand-linkedin"
337+
}
338+
end
339+
340+
defp social_link(user, :github), do: if(login = user.provider_login, do: "https://github.com/#{login}")
341+
defp social_link(user, platform), do: Map.get(user, :"#{platform}_url")
298342
end

0 commit comments

Comments
 (0)