@@ -77,7 +77,7 @@ defmodule AlgoraWeb.Org.BountiesLive do
7777 < div class = "scrollbar-thin w-full overflow-auto " >
7878 < table class = "w-full caption-bottom text-sm " >
7979 < tbody class = "[&_tr:last-child]:border-0 " >
80- <%= for % { bounty: bounty , claims: claims } <- @ bounties do %>
80+ <%= for % { bounty: bounty , claim_groups: claim_groups } <- @ bounties do %>
8181 < tr
8282 class = "bg-white/[2%] from-white/[2%] via-white/[2%] to-white/[2%] border-b border-white/15 bg-gradient-to-br transition-colors data-[state=selected]:bg-gray-100 hover:bg-gray-100/50 dark:data-[state=selected]:bg-gray-800 dark:hover:bg-white/[2%] "
8383 data-state = "false "
@@ -117,25 +117,29 @@ defmodule AlgoraWeb.Org.BountiesLive do
117117 </ div >
118118 </ td >
119119 < td class = "[&:has([role=checkbox])]:pr-0 p-4 align-middle " >
120- <%= if length ( claims ) > 0 do %>
120+ <%= if map_size ( claim_groups ) > 0 do %>
121121 < div class = "group flex cursor-pointer flex-col items-center gap-1 " >
122122 < div class = "flex cursor-pointer justify-center -space-x-3 " >
123- <%= for claim <- claims do %>
123+ <%= for { _group_id , claims } <- claim_groups do %>
124124 < div class = "relative h-10 w-10 flex-shrink-0 rounded-full ring-4 ring-gray-800 group-hover:brightness-110 " >
125125 < img
126- alt = { User . handle ( claim . user ) }
126+ alt = { User . handle ( hd ( claims ) . user ) }
127127 loading = "lazy "
128128 decoding = "async "
129129 class = "rounded-full "
130- src = { claim . user . avatar_url }
130+ src = { hd ( claims ) . user . avatar_url }
131131 style = "position: absolute; height: 100%; width: 100%; inset: 0px; color: transparent; "
132132 />
133133 </ div >
134134 <% end %>
135135 </ div >
136136 < div class = "flex items-center gap-0.5 " >
137137 < div class = "whitespace-nowrap text-sm font-medium text-gray-300 group-hover:text-gray-100 " >
138- { length ( claims ) } { ngettext ( "claim" , "claims" , length ( claims ) ) }
138+ { map_size ( claim_groups ) } { ngettext (
139+ "claim" ,
140+ "claims" ,
141+ map_size ( claim_groups )
142+ ) }
139143 </ div >
140144 < svg
141145 xmlns = "http://www.w3.org/2000/svg "
@@ -156,7 +160,7 @@ defmodule AlgoraWeb.Org.BountiesLive do
156160 <% end %>
157161 </ td >
158162 </ tr >
159- <%= for claim <- claims do %>
163+ <%= for { _group_id , claims } <- claim_groups do %>
160164 < tr
161165 class = "border-b border-white/15 bg-gray-950/50 transition-colors data-[state=selected]:bg-gray-100 hover:bg-gray-100/50 dark:data-[state=selected]:bg-gray-800 dark:hover:bg-gray-950/50 "
162166 data-state = "false "
@@ -165,23 +169,27 @@ defmodule AlgoraWeb.Org.BountiesLive do
165169 < div class = "min-w-[250px] " >
166170 < div class = "flex items-center gap-3 " >
167171 < div class = "flex -space-x-3 " >
168- < div class = "relative h-10 w-10 flex-shrink-0 rounded-full ring-4 ring-gray-800 " >
169- < img
170- alt = { User . handle ( claim . user ) }
171- loading = "lazy "
172- decoding = "async "
173- class = "rounded-full "
174- src = { claim . user . avatar_url }
175- style = "position: absolute; height: 100%; width: 100%; inset: 0px; color: transparent; "
176- />
177- </ div >
172+ <%= for claim <- claims do %>
173+ < div class = "relative h-10 w-10 flex-shrink-0 rounded-full ring-4 ring-background " >
174+ < img
175+ alt = { User . handle ( claim . user ) }
176+ loading = "lazy "
177+ decoding = "async "
178+ class = "rounded-full "
179+ src = { claim . user . avatar_url }
180+ style = "position: absolute; height: 100%; width: 100%; inset: 0px; color: transparent; "
181+ />
182+ </ div >
183+ <% end %>
178184 </ div >
179185 < div >
180186 < div class = "text-sm font-medium text-gray-200 " >
181- { User . handle ( claim . user ) }
187+ { claims
188+ |> Enum . map ( fn c -> User . handle ( c . user ) end )
189+ |> Algora.Util . format_name_list ( ) }
182190 </ div >
183191 < div class = "text-xs text-gray-400 " >
184- { Algora.Util . time_ago ( claim . inserted_at ) }
192+ { Algora.Util . time_ago ( hd ( claims ) . inserted_at ) }
185193 </ div >
186194 </ div >
187195 </ div >
@@ -191,10 +199,10 @@ defmodule AlgoraWeb.Org.BountiesLive do
191199 < div class = "min-w-[180px] " >
192200 < div class = "flex items-center justify-end gap-4 " >
193201 < . button variant = "secondary " >
194- < . link href = { claim . source . url } > View</ . link >
202+ < . link href = { hd ( claims ) . source . url } > View</ . link >
195203 </ . button >
196204 < . button >
197- < . link href = { ~p" /claims/#{ claim . group_id } " } > Reward</ . link >
205+ < . link href = { ~p" /claims/#{ hd ( claims ) . group_id } " } > Reward</ . link >
198206 </ . button >
199207 </ div >
200208 </ div >
@@ -242,11 +250,13 @@ defmodule AlgoraWeb.Org.BountiesLive do
242250 |> Enum . map ( & & 1 . ticket . id )
243251 |> Bounties . list_claims ( )
244252 |> Enum . group_by ( & & 1 . target_id )
253+ |> Map . new ( fn { ticket_id , claims } ->
254+ { ticket_id , Enum . group_by ( claims , & & 1 . group_id ) }
255+ end )
245256
246257 bounties =
247258 Enum . map ( bounties , fn bounty ->
248- # TODO: group claims by group_id
249- % { bounty: bounty , claims: Map . get ( claims_by_ticket , bounty . ticket . id , [ ] ) }
259+ % { bounty: bounty , claim_groups: Map . get ( claims_by_ticket , bounty . ticket . id , % { } ) }
250260 end )
251261
252262 { :noreply ,
0 commit comments