File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -356,7 +356,8 @@ defmodule Atomic.Activities do
356356 def list_activity_participants ( id ) do
357357 from ( u in User ,
358358 join: e in assoc ( u , :enrollments ) ,
359- where: e . activity_id == ^ id
359+ where: e . activity_id == ^ id ,
360+ preload: [ enrollments: e ]
360361 )
361362 end
362363
Original file line number Diff line number Diff line change @@ -47,14 +47,20 @@ defmodule AtomicWeb.Components.Activity do
4747 < span class = "inline-flex items-center text-sm " >
4848 < span class = "inline-flex space-x-2 text-zinc-400 " >
4949 < . icon name = "hero-calendar-solid " class = "mr-1.5 h-5 w-5 flex-shrink-0 text-zinc-400 " />
50- < span class = "font-medium text-zinc-900 " > <%= pretty_display_date ( @ activity . start ) %> </ span >
50+ <%= if Timex . to_date ( @ activity . start ) == Timex . to_date ( @ activity . finish ) do %>
51+ < span class = "font-medium text-zinc-900 " > <%= pretty_display_date ( @ activity . start ) %> </ span >
52+ <% else %>
53+ < span class = "font-medium text-zinc-900 " > <%= pretty_display_date ( @ activity . start ) %> </ span >
54+ < . icon name = "hero-arrow-right " class = "size-4 mt-[3px] " />
55+ < span class = "font-medium text-zinc-900 " > <%= pretty_display_date ( @ activity . finish ) %> </ span >
56+ <% end %>
5157 < span class = "sr-only " > starting in</ span >
5258 </ span >
5359 </ span >
5460 < span class = "inline-flex items-center text-sm " >
5561 < span class = "inline-flex space-x-2 text-zinc-400 " >
5662 < . icon name = "hero-user-group-solid " class = "size-5 " />
57- < span class = "font-medium text-zinc-900 " > <%= @ activity . enrolled %> / <%= @ activity . maximum_entries %> </ span >
63+ < span class = "font-medium text-zinc-900 " > <%= @ activity . enrolled %> <%= if @ activity . maximum_entries , do: "/" %> <%= @ activity . maximum_entries %> </ span >
5864 < span class = "sr-only text-zinc-400 " > enrollments</ span >
5965 </ span >
6066 </ span >
Original file line number Diff line number Diff line change 2323 </ div >
2424 </ div >
2525 < div class = "flex w-full " >
26- < div class = "justify-top flex hidden flex-col items-center pt-3 sm:block " >
26+ < div class = "justify-top hidden sm: flex flex -col items-center pt-3 " >
2727 < div class = "size-3 bg-primary-600 m-1 rounded-full " />
2828 < div class = "flex justify-center " >
2929 < div class = "border-l-primary-600 h-[3.25rem] w-[3px] border-l border-dashed " />
134134 </ div >
135135 < . modal :if = { @ description_modal } id = "description-modal " show on_cancel = { JS . push ( "toggle_description_modal" , target: @ myself ) } >
136136 < div class = "mt-4 flex-grow " >
137- < . field class = "\-h-10 resize-none " type = "textarea " field = { @ form [ :description ] } label = "Description " placeholder = "Choose description " rows = { 15 } required />
137+ < . field class = "\-h-10 resize-none atomic-button atomic-button--primary-outline " type = "textarea " field = { @ form [ :description ] } label = "Description " placeholder = "Choose description " rows = { 15 } required />
138138 < div class = "flex w-full justify-end " >
139139 < . button class = "text " type = "button " phx-click = "toggle_description_modal " phx-target = { @ myself } >
140140 < span > <%= gettext ( "Done" ) %> </ span >
146146 < div class = "h-full w-full " >
147147 < div class = "" >
148148 <%= if @ has_max_capacity? do %>
149- < . field class = "" type = "number " field = { @ form [ :maximum_entries ] } placeholder = "Choose maximum entries " />
149+ < . field class = "atomic-button atomic-button--primary-outline " type = "number " field = { @ form [ :maximum_entries ] } placeholder = "Choose maximum entries " />
150150 <% else %>
151- < . field class = "" type = "number " field = { @ form [ :maximum_entries ] } value = "" placeholder = "∞ Unlimited " />
151+ < . field class = "atomic-button atomic-button--primary-outline " type = "number " field = { @ form [ :maximum_entries ] } value = "" placeholder = "∞ Unlimited " />
152152 <% end %>
153153 </ div >
154154 < div class = "flex gap-3 " >
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ defmodule AtomicWeb.ActivityLive.Show do
7878 end
7979
8080 def handle_event ( "handle_participants_modal" , _ , socket ) do
81+ IO . inspect ( socket )
8182 { :noreply , socket |> assign ( :participants_modal , not socket . assigns . participants_modal ) }
8283 end
8384
Original file line number Diff line number Diff line change 264264 </ div >
265265</ . modal >
266266<!-- Participants show modal -->
267- < . modal :if = { @ participants_modal } show id = "participants_modal " on_cancel = { JS . push ( "handle_participants_modal" ) } >
268- < span class = "flex-l text-lg font-semibold text-gray-900 " > Participants</ span >
267+ < . modal :if = { @ participants_modal } show class = "max-w-[500px] " id = "participants_modal " on_cancel = { JS . push ( "handle_participants_modal" ) } >
268+ < div class = "flex w-full justify-center " >
269+ < span class = "flex-l text-lg font-semibold text-gray-900 " > Participants</ span >
270+ </ div >
269271 <%= if length ( @ participants ) != 0 do %>
270272 < div class = "flex justify-center place-items-center w-full " >
271- < div class = "align-center mt-4 grid gap-4 grid-cols-1 sm:grid-cols-2 md:grid-cols-3 w-fit " >
273+ < div class = "align-center mt-4 grid gap-4 grid-cols-1 w-fit max-h-80 overflow-auto scrollbar-hide " >
272274 <%= for participant <- @ participants do %>
273- < div class = "flex h-10 " >
274- < . avatar size = { :xs } name = { participant . name } type = { :user } />
275- < . link navigate = { ~p" /profile/#{ participant . slug } " } class = "ml-4 hover:underline " > <%= participant . name %> </ . link >
275+ < div class = "flex h-10 place-items-center justify-between " >
276+ < div class = "flex place-items-center " >
277+ < . avatar size = { :xs } name = { participant . name } type = { :user } />
278+ < . link navigate = { ~p" /profile/#{ participant . slug } " } class = "ml-4 hover:underline " > <%= participant . name %> </ . link >
279+ </ div >
280+ < span class = "ml-2 text-gray-500 hidden sm:block " > <%= relative_datetime ( participant . enrollments |> List . first ( ) |> Map . get ( :inserted_at ) ) %> </ span >
276281 </ div >
277282 <% end %>
278283 </ div >
You can’t perform that action at this time.
0 commit comments