@@ -8,6 +8,8 @@ defmodule AlgoraWeb.HomeLive do
88 alias Algora.Accounts
99 alias Algora.Bounties
1010 alias Algora.Jobs
11+ alias Algora.Matches
12+ alias Algora.Matches.JobMatch
1113 alias Algora.Payments
1214 alias AlgoraWeb.Components.Footer
1315 alias AlgoraWeb.Components.Header
@@ -966,6 +968,70 @@ defmodule AlgoraWeb.HomeLive do
966968 """
967969 end
968970
971+ defp event_item ( % { type: :ats } = assigns ) do
972+ assigns = assign ( assigns , :match , assigns . event . item . match )
973+ assigns = assign ( assigns , :data , assigns . event . item . event )
974+
975+ ~H"""
976+ < div >
977+ < div class = "relative -ml-[2.75rem] " >
978+ < span
979+ :if = { ! @ last? }
980+ class = "absolute left-1 top-6 h-full w-0.5 block ml-[2.75rem] bg-muted-foreground/25 "
981+ aria-hidden = "true "
982+ >
983+ </ span >
984+ < . link
985+ rel = "noopener "
986+ target = "_blank "
987+ class = "w-full group inline-flex "
988+ href = { "/#{ @ match . job_posting . user . handle } /home" }
989+ >
990+ < div class = "w-full relative flex space-x-3 " >
991+ < div class = "w-full flex min-w-0 flex-1 justify-between space-x-4 pt-1.5 " >
992+ < div class = "w-full flex items-center gap-3 " >
993+ < div class = "flex -space-x-1 ring-8 ring-black " >
994+ < span class = "relative shrink-0 overflow-hidden flex h-9 w-9 sm:h-12 sm:w-12 items-center justify-center rounded-xl ring-4 bg-gray-950 ring-black " >
995+ < img
996+ class = "aspect-square h-full w-full "
997+ alt = { @ match . job_posting . user . name }
998+ src = { @ match . job_posting . user . avatar_url }
999+ />
1000+ </ span >
1001+ < span class = "relative shrink-0 overflow-hidden flex h-9 w-9 sm:h-12 sm:w-12 items-center justify-center rounded-xl ring-4 bg-gray-950 ring-black " >
1002+ < img
1003+ class = "aspect-square h-full w-full "
1004+ alt = { @ match . user . name }
1005+ src = { @ match . user . avatar_url }
1006+ />
1007+ </ span >
1008+ </ div >
1009+
1010+ < div class = "w-full z-10 flex gap-3 items-start xl:items-end " >
1011+ < p class = "text-xs transition-colors text-muted-foreground group-hover:text-foreground/90 sm:text-xl text-left " >
1012+ < span class = "font-semibold text-foreground/80 group-hover:text-foreground transition-colors " >
1013+ { @ match . job_posting . user . name }
1014+ </ span >
1015+ { Algora.Cloud . label_ats_event ( @ data [ "title" ] ) || " <> " }
1016+ < span class = "font-semibold text-foreground/80 group-hover:text-foreground transition-colors " >
1017+ { @ match . user . name }
1018+ </ span >
1019+ </ p >
1020+ < div class = "ml-auto xl:ml-0 xl:mb-[2px] whitespace-nowrap text-xs text-muted-foreground sm:text-sm " >
1021+ < time datetime = { @ event . timestamp } >
1022+ { Algora.Util . time_ago ( @ event . timestamp ) }
1023+ </ time >
1024+ </ div >
1025+ </ div >
1026+ </ div >
1027+ </ div >
1028+ </ div >
1029+ </ . link >
1030+ </ div >
1031+ </ div >
1032+ """
1033+ end
1034+
9691035 def event_card ( assigns ) do
9701036 ~H"""
9711037 < . link
@@ -1154,6 +1220,17 @@ defmodule AlgoraWeb.HomeLive do
11541220 transactions = Payments . list_featured_transactions ( )
11551221 bounties = Bounties . list_bounties ( status: :open , limit: 10 , amount_gt: Money . new ( :USD , 200 ) )
11561222 jobs_by_user = [ ]
1223+ matches = Matches . list_job_matches_with_assocs ( )
1224+
1225+ ats_events =
1226+ Enum . flat_map ( matches , fn match ->
1227+ match
1228+ |> JobMatch . get_application_history ( )
1229+ |> Enum . filter ( fn event -> event [ "id" ] in Algora.Cloud . ats_event_ids ( ) end )
1230+ |> Enum . map ( fn event ->
1231+ % { item: % { match: match , event: event } , type: :ats , timestamp: Algora.Util . to_date! ( event [ "enteredStageAt" ] ) }
1232+ end )
1233+ end )
11571234
11581235 events =
11591236 transactions
@@ -1168,6 +1245,7 @@ defmodule AlgoraWeb.HomeLive do
11681245 % { item: bounty , type: :bounty , timestamp: bounty . inserted_at }
11691246 end )
11701247 )
1248+ |> Enum . concat ( ats_events )
11711249 |> Enum . sort_by ( & & 1 . timestamp , { :desc , DateTime } )
11721250
11731251 assign ( socket , :events , events )
0 commit comments