Skip to content

Commit 0312cfa

Browse files
committed
add payout account status indicator
1 parent c8651b8 commit 0312cfa

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

lib/algora_web/live/user/transactions_live.ex

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,14 @@ defmodule AlgoraWeb.User.TransactionsLive do
3535
Payments.subscribe()
3636
end
3737

38+
account = Payments.get_account(socket.assigns.current_user.id, :US)
39+
3840
{:ok,
3941
socket
4042
|> assign(:page_title, "Your transactions")
41-
|> assign(:show_payout_drawer, true)
43+
|> assign(:show_payout_drawer, false)
4244
|> assign(:payout_account_form, to_form(PayoutAccountForm.changeset(%PayoutAccountForm{}, %{})))
45+
|> assign(:account, account)
4346
|> assign_transactions()}
4447
end
4548

@@ -150,15 +153,26 @@ defmodule AlgoraWeb.User.TransactionsLive do
150153
def render(assigns) do
151154
~H"""
152155
<div class="container mx-auto max-w-7xl space-y-6 p-6">
153-
<div class="flex items-end justify-between gap-4">
154-
<div class="space-y-1">
155-
<h1 class="text-2xl font-bold">Your Transactions</h1>
156-
<p class="text-muted-foreground">View and manage your transaction history</p>
156+
<div class="space-y-4">
157+
<div class="flex items-end justify-between gap-4">
158+
<div class="space-y-1">
159+
<h1 class="text-2xl font-bold">Your Transactions</h1>
160+
<p class="text-muted-foreground">View and manage your transaction history</p>
161+
</div>
162+
<.button phx-click="show_payout_drawer">
163+
<.icon name="tabler-plus" class="w-4 h-4 mr-2 -ml-1" />
164+
<span>Create payout account</span>
165+
</.button>
157166
</div>
158-
<.button phx-click="show_payout_drawer">
159-
<.icon name="tabler-plus" class="w-4 h-4 mr-2 -ml-1" />
160-
<span>Create payout account</span>
161-
</.button>
167+
<%= if @account do %>
168+
<div class="flex items-center gap-2">
169+
<.badge variant={if @account.charges_enabled, do: "success", else: "warning"}>
170+
{if @account.charges_enabled,
171+
do: "Payout account active",
172+
else: "Payout account setup required"}
173+
</.badge>
174+
</div>
175+
<% end %>
162176
</div>
163177
164178
<!-- Totals Cards -->

0 commit comments

Comments
 (0)