@@ -150,12 +150,28 @@ defmodule AlgoraWeb.Admin.AdminLive do
150150 < . stat_card title = { metric . label } value = { metric . value } />
151151 <% end %>
152152 </ div >
153- < div class = "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-4 " >
154- <%= for { _date , metrics } <- Enum . take ( @ user_metrics , 1 ) do %>
155- < . stat_card title = "Organization Signups " value = { metrics . org_signups } subtitle = "Last 24h " />
156- < . stat_card title = "Organization Returns " value = { metrics . org_returns } subtitle = "Last 24h " />
157- < . stat_card title = "Developer Signups " value = { metrics . dev_signups } subtitle = "Last 24h " />
158- < . stat_card title = "Developer Returns " value = { metrics . dev_returns } subtitle = "Last 24h " />
153+ < div :if = { @ timezone } class = "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-4 " >
154+ <%= for { date , metrics } <- Enum . take ( @ user_metrics , 1 ) do %>
155+ < . stat_card
156+ title = "Organization Signups "
157+ value = { metrics . org_signups }
158+ subtext = { format_date ( date , @ timezone ) }
159+ />
160+ < . stat_card
161+ title = "Organization Returns "
162+ value = { metrics . org_returns }
163+ subtext = { format_date ( date , @ timezone ) }
164+ />
165+ < . stat_card
166+ title = "Developer Signups "
167+ value = { metrics . dev_signups }
168+ subtext = { format_date ( date , @ timezone ) }
169+ />
170+ < . stat_card
171+ title = "Developer Returns "
172+ value = { metrics . dev_returns }
173+ subtext = { format_date ( date , @ timezone ) }
174+ />
159175 <% end %>
160176 </ div >
161177 </ section >
@@ -536,10 +552,7 @@ defmodule AlgoraWeb.Admin.AdminLive do
536552 defp cell ( % { value: % NaiveDateTime { } } = assigns ) do
537553 ~H"""
538554 < span :if = { @ timezone } class = "tabular-nums whitespace-nowrap text-sm " >
539- { Calendar . strftime (
540- DateTime . from_naive! ( @ value , "Etc/UTC" ) |> DateTime . shift_zone! ( @ timezone ) ,
541- "%Y/%m/%d, %H:%M:%S"
542- ) }
555+ { format_date ( @ value , @ timezone ) }
543556 </ span >
544557 """
545558 end
@@ -681,4 +694,11 @@ defmodule AlgoraWeb.Admin.AdminLive do
681694 updated_queries = Map . put ( queries , name , query )
682695 Algora.Settings . set ( "saved_queries" , updated_queries )
683696 end
697+
698+ defp format_date ( date , timezone ) do
699+ date
700+ |> DateTime . from_naive! ( "Etc/UTC" )
701+ |> DateTime . shift_zone! ( timezone )
702+ |> Calendar . strftime ( "%Y/%m/%d, %H:%M:%S" )
703+ end
684704end
0 commit comments