diff --git a/lib/music_library_web/components/data_components.ex b/lib/music_library_web/components/data_components.ex deleted file mode 100644 index 6950826a..00000000 --- a/lib/music_library_web/components/data_components.ex +++ /dev/null @@ -1,68 +0,0 @@ -defmodule MusicLibraryWeb.DataComponents do - use MusicLibraryWeb, :live_component - - attr :record, MusicLibrary.Records.Record, required: true - attr :title, :string, required: true - attr :class, :string - - def album_preview(assigns) do - ~H""" -
-
- {@record.title} -

- {@title} -

-
-
-

- - {@record.title} - - <.link - :for={artist <- @record.artists} - class="text-sm md:text-base text-zinc-600 dark:text-zinc-200 hover:text-zinc-500 dark:text-zinc-300 dark:hover:text-zinc-200" - navigate={~p"/artists/#{artist.musicbrainz_id}"} - > - {artist.name} - -

-
-
- """ - end - - attr :title, :string, required: true - attr :count, :integer, required: true - attr :path, :string, required: true - - def counter(assigns) do - ~H""" -
-
-

- {@title} -

-
-
- <.link - navigate={@path} - class="block text-2xl sm:text-3xl font-semibold text-center text-zinc-900 hover:text-zinc-500 dark:text-zinc-300 dark:hover:text-zinc-200" - > - {@count} - -
-
- """ - end -end diff --git a/lib/music_library_web/live/stats_live/index.ex b/lib/music_library_web/live/stats_live/index.ex index 2afdff23..24728398 100644 --- a/lib/music_library_web/live/stats_live/index.ex +++ b/lib/music_library_web/live/stats_live/index.ex @@ -1,12 +1,76 @@ defmodule MusicLibraryWeb.StatsLive.Index do use MusicLibraryWeb, :live_view - import MusicLibraryWeb.DataComponents import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1] import MusicLibraryWeb.ChartComponents alias MusicLibrary.{Artists, Collection, Records, Wishlist} + attr :record, MusicLibrary.Records.Record, required: true + attr :title, :string, required: true + attr :class, :string + + defp album_preview(assigns) do + ~H""" +
+
+ {@record.title} +

+ {@title} +

+
+
+

+ + {@record.title} + + <.link + :for={artist <- @record.artists} + class="text-sm md:text-base text-zinc-600 dark:text-zinc-200 hover:text-zinc-500 dark:text-zinc-300 dark:hover:text-zinc-200" + navigate={~p"/artists/#{artist.musicbrainz_id}"} + > + {artist.name} + +

+
+
+ """ + end + + attr :title, :string, required: true + attr :count, :integer, required: true + attr :path, :string, required: true + + defp counter(assigns) do + ~H""" +
+
+

+ {@title} +

+
+
+ <.link + navigate={@path} + class="block text-2xl sm:text-3xl font-semibold text-center text-zinc-900 hover:text-zinc-500 dark:text-zinc-300 dark:hover:text-zinc-200" + > + {@count} + +
+
+ """ + end + def mount(_params, _session, socket) do latest_record = Collection.get_latest_record!() recent_tracks = LastFm.get_scrobbled_tracks()