Add "On this day" section to stats
This commit is contained in:
@@ -13,6 +13,7 @@ defmodule MusicLibraryWeb.StatsLive.Index do
|
||||
recent_tracks = LastFm.get_scrobbled_tracks()
|
||||
records_by_artists = Collection.count_records_by_artist(limit: 20)
|
||||
records_by_genre = Collection.count_records_by_genre(limit: 20)
|
||||
records_on_this_day = Collection.get_records_on_this_day()
|
||||
|
||||
if connected?(socket) do
|
||||
LastFm.subscribe_to_feed()
|
||||
@@ -27,6 +28,7 @@ defmodule MusicLibraryWeb.StatsLive.Index do
|
||||
|> stream_configure(:recent_albums,
|
||||
dom_id: fn album -> "album-#{album.scrobbled_at_uts}" end
|
||||
)
|
||||
|> stream(:records_on_this_day, records_on_this_day, reset: true)
|
||||
|> assign_counts()
|
||||
|> assign_scrobble_activity(recent_tracks)
|
||||
|> assign(
|
||||
|
||||
@@ -487,7 +487,16 @@
|
||||
</.tabs>
|
||||
</div>
|
||||
|
||||
<div class="mt-5 grid grid-cols-1 lg:grid-cols-2 gap-5">
|
||||
<div class="mt-5 grid grid-cols-1 lg:grid-cols-3 gap-4">
|
||||
<div class="px-4 shadow-sm">
|
||||
<h1 class="text-base lg:text-2xl text-zinc-900 dark:text-zinc-200 font-semibold">
|
||||
{gettext("On This day")}
|
||||
</h1>
|
||||
<.records_on_this_day
|
||||
records={@streams.records_on_this_day}
|
||||
record_show_path={fn record -> ~p"/collection/#{record}" end}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<h1 class="text-base lg:text-2xl text-zinc-900 dark:text-zinc-200 font-semibold">
|
||||
{gettext("Top %{n} Artists", %{n: length(@records_by_artist)})}
|
||||
|
||||
Reference in New Issue
Block a user