@@ -55,6 +55,32 @@ defmodule AlgoraWeb.HomeLive do
55
55
featured_devs = Accounts . list_featured_developers ( )
56
56
featured_collabs = list_featured_collabs ( )
57
57
58
+ transactions =
59
+ Repo . all (
60
+ from tx in Transaction ,
61
+ where: tx . type == :credit ,
62
+ where: not is_nil ( tx . succeeded_at ) ,
63
+ where:
64
+ fragment (
65
+ "? >= ('USD', 500)::money_with_currency" ,
66
+ tx . net_amount
67
+ ) ,
68
+ join: u in assoc ( tx , :user ) ,
69
+ join: b in assoc ( tx , :bounty ) ,
70
+ join: t in assoc ( b , :ticket ) ,
71
+ join: r in assoc ( t , :repository ) ,
72
+ join: o in assoc ( r , :user ) ,
73
+ join: ltx in assoc ( tx , :linked_transaction ) ,
74
+ join: ltx_user in assoc ( ltx , :user ) ,
75
+ select_merge: % {
76
+ user: u ,
77
+ bounty: % { b | ticket: % { t | repository: % { r | user: o } } } ,
78
+ linked_transaction: % { ltx | user: ltx_user }
79
+ } ,
80
+ order_by: [ desc: tx . succeeded_at ] ,
81
+ limit: 5
82
+ )
83
+
58
84
case socket . assigns [ :current_user ] do
59
85
nil ->
60
86
{ :ok ,
@@ -75,7 +101,8 @@ defmodule AlgoraWeb.HomeLive do
75
101
|> assign ( :total_countries , total_countries )
76
102
|> assign ( :selected_developer , nil )
77
103
|> assign ( :share_drawer_type , nil )
78
- |> assign ( :show_share_drawer , false ) }
104
+ |> assign ( :show_share_drawer , false )
105
+ |> assign ( :transactions , transactions ) }
79
106
80
107
user ->
81
108
{ :ok , redirect ( socket , to: AlgoraWeb.UserAuth . signed_in_path ( user ) ) }
@@ -156,16 +183,22 @@ defmodule AlgoraWeb.HomeLive do
156
183
< section class = "relative isolate min-h-[100svh] bg-gradient-to-b from-background to-black " >
157
184
< . pattern />
158
185
< div class = "mx-auto max-w-7xl pt-24 pb-12 xl:pt-20 " >
159
- < div class = "mx-auto lg:mx-0 lg:flex lg:max-w-none lg:items-center " >
160
- < div class = "px-6 lg:px-8 lg:pr-0 xl:pb-20 relative w-full lg:max-w-xl lg:shrink-0 xl:max-w-3xl 2xl:max-w-3xl " >
186
+ < div class = "mx-auto lg:mx-0 lg:flex lg:max-w-none " >
187
+ < div class = {
188
+ classes ( [
189
+ "px-6 lg:px-8 lg:pr-0 xl:py-20 relative w-full lg:max-w-xl lg:shrink-0 xl:max-w-3xl 2xl:max-w-3xl" ,
190
+ @ screenshot? && "pt-24"
191
+ ] )
192
+ } >
193
+ < . wordmark :if = { @ screenshot? } class = "h-8 mb-6 " />
161
194
< h1 class = "font-display text-3xl sm:text-4xl md:text-5xl xl:text-7xl font-semibold tracking-tight text-foreground " >
162
195
The open source Upwork for engineers
163
196
</ h1 >
164
197
< p class = "mt-4 sm:mt-8 text-base sm:text-lg xl:text-2xl/8 font-medium text-muted-foreground sm:max-w-md lg:max-w-none " >
165
198
Discover GitHub bounties, contract work and jobs.< br class = "hidden sm:block " />
166
199
Hire the top 1% open source developers.
167
200
</ p >
168
- < div class = "mt-6 sm:mt-10 flex gap-4 " >
201
+ < div :if = { ! @ screenshot? } class = "mt-6 sm:mt-10 flex gap-4 " >
169
202
< . button
170
203
navigate = { ~p" /onboarding/org" }
171
204
class = "h-10 sm:h-14 rounded-md px-8 sm:px-12 text-sm sm:text-xl "
@@ -180,6 +213,9 @@ defmodule AlgoraWeb.HomeLive do
180
213
Developers
181
214
</ . button >
182
215
</ div >
216
+ < div class = "flex flex-col gap-4 pt-6 sm:pt-10 " >
217
+ < . events transactions = { @ transactions } />
218
+ </ div >
183
219
</ div >
184
220
<!-- Featured devs -->
185
221
< div class = {
@@ -1630,4 +1666,73 @@ defmodule AlgoraWeb.HomeLive do
1630
1666
</ div >
1631
1667
"""
1632
1668
end
1669
+
1670
+ defp events ( assigns ) do
1671
+ ~H"""
1672
+ < ul class = "w-full pl-10 relative space-y-8 " >
1673
+ < li :for = { { transaction , index } <- @ transactions |> Enum . with_index ( ) } class = "relative " >
1674
+ < div >
1675
+ < div class = "relative -ml-[2.75rem] " >
1676
+ < span
1677
+ :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 "
1679
+ aria-hidden = "true "
1680
+ >
1681
+ </ span >
1682
+ < . link
1683
+ rel = "noopener "
1684
+ target = "_blank "
1685
+ class = "w-full group inline-flex "
1686
+ href = { transaction . bounty . ticket . url }
1687
+ >
1688
+ < div class = "w-full relative flex space-x-3 " >
1689
+ < div class = "w-full flex min-w-0 flex-1 justify-between space-x-4 pt-1.5 " >
1690
+ < div class = "w-full flex items-center gap-3 " >
1691
+ < 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] " >
1693
+ < img
1694
+ class = "aspect-square h-full w-full "
1695
+ alt = { transaction . user . name }
1696
+ src = { transaction . user . avatar_url }
1697
+ />
1698
+ </ 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] " >
1700
+ < img
1701
+ class = "aspect-square h-full w-full "
1702
+ alt = { transaction . linked_transaction . user . name }
1703
+ src = { transaction . linked_transaction . user . avatar_url }
1704
+ />
1705
+ </ span >
1706
+ </ div >
1707
+ < div class = "w-full z-10 flex gap-3 items-start xl:items-end " >
1708
+ < p class = "text-xs transition-colors text-muted-foreground group-hover:text-foreground/90 sm:text-base " >
1709
+ < span class = "font-semibold text-foreground/80 group-hover:text-foreground transition-colors " >
1710
+ { transaction . linked_transaction . user . name }
1711
+ </ span >
1712
+ awarded
1713
+ < span class = "font-semibold text-foreground/80 group-hover:text-foreground transition-colors " >
1714
+ { transaction . user . name }
1715
+ </ span >
1716
+ a
1717
+ < span class = "font-bold font-display text-success-400 group-hover:text-success-300 transition-colors " >
1718
+ { Money . to_string! ( transaction . net_amount ) }
1719
+ </ span >
1720
+ bounty
1721
+ </ p >
1722
+ < div class = "ml-auto xl:ml-0 xl:mb-[2px] whitespace-nowrap text-xs text-muted-foreground sm:text-sm " >
1723
+ < time datetime = { transaction . succeeded_at } >
1724
+ { Algora.Util . time_ago ( transaction . succeeded_at ) }
1725
+ </ time >
1726
+ </ div >
1727
+ </ div >
1728
+ </ div >
1729
+ </ div >
1730
+ </ div >
1731
+ </ . link >
1732
+ </ div >
1733
+ </ div >
1734
+ </ li >
1735
+ </ ul >
1736
+ """
1737
+ end
1633
1738
end
0 commit comments