Skip to content

Commit 6e194b7

Browse files
committed
feat: update BountyLive layout and user display
- Added an alias for the Admin module to streamline user management. - Enhanced the layout of the main display area, adjusting padding and height for better usability. - Updated the avatar fallback to show initials instead of the first character of the provider login. - Refactored the exclusives assignment logic to utilize the Admin token for user retrieval, improving security and consistency.
1 parent a6be136 commit 6e194b7

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lib/algora_web/live/bounty_live.ex

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ defmodule AlgoraWeb.BountyLive do
55
import Ecto.Changeset
66

77
alias Algora.Accounts
8+
alias Algora.Admin
89
alias Algora.Bounties
910
alias Algora.Bounties.Bounty
1011
alias Algora.Bounties.LineItem
@@ -322,8 +323,8 @@ defmodule AlgoraWeb.BountyLive do
322323
@impl true
323324
def render(assigns) do
324325
~H"""
325-
<div class="flex">
326-
<.scroll_area class="h-[calc(100vh-64px)] flex-1 p-4 pr-6">
326+
<div class={classes(["flex p-4", if(!@current_user, do: "pb-16 sm:pb-24")])}>
327+
<.scroll_area class="h-[calc(100vh-96px)] flex-1 pr-6">
327328
<div class="space-y-4">
328329
<.card>
329330
<.card_content>
@@ -332,7 +333,7 @@ defmodule AlgoraWeb.BountyLive do
332333
<.avatar class="h-20 w-20 rounded-2xl">
333334
<.avatar_image src={@ticket.repository.user.avatar_url} />
334335
<.avatar_fallback>
335-
{String.first(@ticket.repository.user.provider_login)}
336+
{Util.initials(@ticket.repository.user.provider_login)}
336337
</.avatar_fallback>
337338
</.avatar>
338339
<div>
@@ -468,7 +469,7 @@ defmodule AlgoraWeb.BountyLive do
468469
</div>
469470
</.scroll_area>
470471
471-
<div class="h-[calc(100vh-64px)] w-[400px] flex flex-none flex-col border-l border-border">
472+
<div class="h-[calc(100vh-96px)] w-[400px] flex flex-none flex-col border rounded-xl">
472473
<div class="flex flex-none items-center justify-between border-b border-border bg-card/50 p-4 backdrop-blur supports-[backdrop-filter]:bg-background/60">
473474
<div class="flex justify-between items-center w-full">
474475
<h2 class="text-lg font-semibold">
@@ -763,10 +764,8 @@ defmodule AlgoraWeb.BountyLive do
763764
defp assign_exclusives(socket, shared_with) do
764765
exclusives =
765766
Enum.flat_map(shared_with, fn provider_id ->
766-
with {:ok, token} <- Accounts.get_access_token(socket.assigns.current_user),
767-
{:ok, user} <- Workspace.ensure_user_by_provider_id(token, provider_id) do
768-
[user]
769-
else
767+
case Workspace.ensure_user_by_provider_id(Admin.token!(), provider_id) do
768+
{:ok, user} -> [user]
770769
_ -> []
771770
end
772771
end)

0 commit comments

Comments
 (0)