Skip to content

Commit e87f2d4

Browse files
committed
fix: improve homepage timeline
1 parent 6f16815 commit e87f2d4

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

lib/algora_web/live/home_live.ex

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ defmodule AlgoraWeb.HomeLive do
1111
alias Algora.Payments.Transaction
1212
alias Algora.Repo
1313
alias Algora.Workspace
14+
alias Algora.Workspace.Ticket
1415
alias AlgoraWeb.Components.Footer
1516
alias AlgoraWeb.Components.Header
1617
alias AlgoraWeb.Components.Logos
@@ -66,15 +67,21 @@ defmodule AlgoraWeb.HomeLive do
6667
tx.net_amount
6768
),
6869
join: u in assoc(tx, :user),
69-
join: b in assoc(tx, :bounty),
70-
join: t in assoc(b, :ticket),
70+
left_join: b in assoc(tx, :bounty),
71+
left_join: tip in assoc(tx, :tip),
72+
join: t in Ticket,
73+
on: t.id == b.ticket_id or t.id == tip.ticket_id,
7174
join: r in assoc(t, :repository),
7275
join: o in assoc(r, :user),
7376
join: ltx in assoc(tx, :linked_transaction),
7477
join: ltx_user in assoc(ltx, :user),
75-
select_merge: %{
78+
select: %{
79+
succeeded_at: tx.succeeded_at,
80+
net_amount: tx.net_amount,
81+
bounty_id: b.id,
82+
tip_id: tip.id,
7683
user: u,
77-
bounty: %{b | ticket: %{t | repository: %{r | user: o}}},
84+
ticket: %{t | repository: %{r | user: o}},
7885
linked_transaction: %{ltx | user: ltx_user}
7986
},
8087
order_by: [desc: tx.succeeded_at],
@@ -1675,28 +1682,28 @@ defmodule AlgoraWeb.HomeLive do
16751682
<div class="relative -ml-[2.75rem]">
16761683
<span
16771684
:if={index != length(@transactions) - 1}
1678-
class="absolute left-2 top-6 -ml-px h-full w-0.5 block ml-[2.75rem] bg-muted-foreground/25"
1685+
class="absolute left-1 top-6 h-full w-0.5 block ml-[2.75rem] bg-muted-foreground/25"
16791686
aria-hidden="true"
16801687
>
16811688
</span>
16821689
<.link
16831690
rel="noopener"
16841691
target="_blank"
16851692
class="w-full group inline-flex"
1686-
href={transaction.bounty.ticket.url}
1693+
href={transaction.ticket.url}
16871694
>
16881695
<div class="w-full relative flex space-x-3">
16891696
<div class="w-full flex min-w-0 flex-1 justify-between space-x-4 pt-1.5">
16901697
<div class="w-full flex items-center gap-3">
16911698
<div class="flex -space-x-1 ring-8 ring-[#050505]">
1692-
<span class="relative shrink-0 overflow-hidden flex h-9 w-9 items-center justify-center rounded-xl ring-4 ring-white bg-gray-950 ring-[#050505]">
1699+
<span class="relative shrink-0 overflow-hidden flex h-9 w-9 items-center justify-center rounded-xl ring-4 bg-gray-950 ring-[#050505]">
16931700
<img
16941701
class="aspect-square h-full w-full"
16951702
alt={transaction.user.name}
16961703
src={transaction.user.avatar_url}
16971704
/>
16981705
</span>
1699-
<span class="relative shrink-0 overflow-hidden flex h-9 w-9 items-center justify-center rounded-xl ring-4 ring-white bg-gray-950 ring-[#050505]">
1706+
<span class="relative shrink-0 overflow-hidden flex h-9 w-9 items-center justify-center rounded-xl ring-4 bg-gray-950 ring-[#050505]">
17001707
<img
17011708
class="aspect-square h-full w-full"
17021709
alt={transaction.linked_transaction.user.name}
@@ -1717,7 +1724,11 @@ defmodule AlgoraWeb.HomeLive do
17171724
<span class="font-bold font-display text-success-400 group-hover:text-success-300 transition-colors">
17181725
{Money.to_string!(transaction.net_amount)}
17191726
</span>
1720-
bounty
1727+
<%= if transaction.bounty_id do %>
1728+
bounty
1729+
<% else %>
1730+
tip
1731+
<% end %>
17211732
</p>
17221733
<div class="ml-auto xl:ml-0 xl:mb-[2px] whitespace-nowrap text-xs text-muted-foreground sm:text-sm">
17231734
<time datetime={transaction.succeeded_at}>

0 commit comments

Comments
 (0)