@@ -77,7 +77,7 @@ defmodule AlgoraWeb.Org.BountiesLive do
77
77
< div class = "scrollbar-thin w-full overflow-auto " >
78
78
< table class = "w-full caption-bottom text-sm " >
79
79
< 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 %>
81
81
< tr
82
82
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%] "
83
83
data-state = "false "
@@ -117,25 +117,29 @@ defmodule AlgoraWeb.Org.BountiesLive do
117
117
</ div >
118
118
</ td >
119
119
< 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 %>
121
121
< div class = "group flex cursor-pointer flex-col items-center gap-1 " >
122
122
< div class = "flex cursor-pointer justify-center -space-x-3 " >
123
- <%= for claim <- claims do %>
123
+ <%= for { _group_id , claims } <- claim_groups do %>
124
124
< div class = "relative h-10 w-10 flex-shrink-0 rounded-full ring-4 ring-gray-800 group-hover:brightness-110 " >
125
125
< img
126
- alt = { User . handle ( claim . user ) }
126
+ alt = { User . handle ( hd ( claims ) . user ) }
127
127
loading = "lazy "
128
128
decoding = "async "
129
129
class = "rounded-full "
130
- src = { claim . user . avatar_url }
130
+ src = { hd ( claims ) . user . avatar_url }
131
131
style = "position: absolute; height: 100%; width: 100%; inset: 0px; color: transparent; "
132
132
/>
133
133
</ div >
134
134
<% end %>
135
135
</ div >
136
136
< div class = "flex items-center gap-0.5 " >
137
137
< 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
+ ) }
139
143
</ div >
140
144
< svg
141
145
xmlns = "http://www.w3.org/2000/svg "
@@ -156,7 +160,7 @@ defmodule AlgoraWeb.Org.BountiesLive do
156
160
<% end %>
157
161
</ td >
158
162
</ tr >
159
- <%= for claim <- claims do %>
163
+ <%= for { _group_id , claims } <- claim_groups do %>
160
164
< tr
161
165
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 "
162
166
data-state = "false "
@@ -165,23 +169,27 @@ defmodule AlgoraWeb.Org.BountiesLive do
165
169
< div class = "min-w-[250px] " >
166
170
< div class = "flex items-center gap-3 " >
167
171
< 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 %>
178
184
</ div >
179
185
< div >
180
186
< 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 ( ) }
182
190
</ div >
183
191
< div class = "text-xs text-gray-400 " >
184
- { Algora.Util . time_ago ( claim . inserted_at ) }
192
+ { Algora.Util . time_ago ( hd ( claims ) . inserted_at ) }
185
193
</ div >
186
194
</ div >
187
195
</ div >
@@ -191,10 +199,10 @@ defmodule AlgoraWeb.Org.BountiesLive do
191
199
< div class = "min-w-[180px] " >
192
200
< div class = "flex items-center justify-end gap-4 " >
193
201
< . button variant = "secondary " >
194
- < . link href = { claim . source . url } > View</ . link >
202
+ < . link href = { hd ( claims ) . source . url } > View</ . link >
195
203
</ . button >
196
204
< . button >
197
- < . link href = { ~p" /claims/#{ claim . group_id } " } > Reward</ . link >
205
+ < . link href = { ~p" /claims/#{ hd ( claims ) . group_id } " } > Reward</ . link >
198
206
</ . button >
199
207
</ div >
200
208
</ div >
@@ -242,11 +250,13 @@ defmodule AlgoraWeb.Org.BountiesLive do
242
250
|> Enum . map ( & & 1 . ticket . id )
243
251
|> Bounties . list_claims ( )
244
252
|> 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 )
245
256
246
257
bounties =
247
258
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 , % { } ) }
250
260
end )
251
261
252
262
{ :noreply ,
0 commit comments