diff --git a/lib/music_library_web/components/scrobble_components.ex b/lib/music_library_web/components/scrobble_components.ex index 5e4ec9c0..338fb463 100644 --- a/lib/music_library_web/components/scrobble_components.ex +++ b/lib/music_library_web/components/scrobble_components.ex @@ -3,6 +3,8 @@ defmodule MusicLibraryWeb.ScrobbleComponents do Universal search modal and related components. """ + alias LastFm.Track + use MusicLibraryWeb, :html def refresh_lastfm_feed_button(assigns) do @@ -22,4 +24,104 @@ defmodule MusicLibraryWeb.ScrobbleComponents do """ end + + attr :track, Track, required: true + + def track_metadata_tooltip(assigns) do + ~H""" + <.tooltip> + <.icon + name="hero-information-circle" + class="h-5 w-5 text-zinc-500 dark:text-zinc-400 cursor-pointer" + aria-hidden="true" + data-slot="icon" + /> + <:content> +
+
+
{gettext("Track ID:")}
+
+ + {@track.musicbrainz_id || gettext("Unknown")} + + +
+
+
+
{gettext("Album ID:")}
+
+ + {@track.album.musicbrainz_id || gettext("Unknown")} + + +
+
+
+
{gettext("Artist ID:")}
+
+ + {@track.artist.musicbrainz_id || gettext("Unknown")} + + +
+
+
+ + + """ + end end diff --git a/lib/music_library_web/live/scrobbled_tracks_live/index.ex b/lib/music_library_web/live/scrobbled_tracks_live/index.ex index 7336f6b5..4693370e 100644 --- a/lib/music_library_web/live/scrobbled_tracks_live/index.ex +++ b/lib/music_library_web/live/scrobbled_tracks_live/index.ex @@ -3,7 +3,7 @@ defmodule MusicLibraryWeb.ScrobbledTracksLive.Index do import MusicLibraryWeb.Components.Pagination import MusicLibraryWeb.RecordComponents, only: [format_label: 1] - import MusicLibraryWeb.ScrobbleComponents, only: [refresh_lastfm_feed_button: 1] + import MusicLibraryWeb.ScrobbleComponents alias LastFm.Track alias MusicLibrary.Assets.Transform @@ -186,4 +186,10 @@ defmodule MusicLibraryWeb.ScrobbledTracksLive.Index do defp track_cover_url(_track, cover_hash) do ~p"/assets/#{Transform.new(hash: cover_hash, width: 96)}" end + + defp format_scrobbled_at_uts(uts) do + uts + |> DateTime.from_unix!() + |> DateTime.to_iso8601() + end end diff --git a/lib/music_library_web/live/scrobbled_tracks_live/index.html.heex b/lib/music_library_web/live/scrobbled_tracks_live/index.html.heex index 42557865..6deeec0e 100644 --- a/lib/music_library_web/live/scrobbled_tracks_live/index.html.heex +++ b/lib/music_library_web/live/scrobbled_tracks_live/index.html.heex @@ -109,9 +109,13 @@

{track.album.title}

-

+

+ + <.track_metadata_tooltip track={track} /> diff --git a/lib/music_library_web/live/stats_live/index.ex b/lib/music_library_web/live/stats_live/index.ex index 2dfe395b..c5245f20 100644 --- a/lib/music_library_web/live/stats_live/index.ex +++ b/lib/music_library_web/live/stats_live/index.ex @@ -5,7 +5,7 @@ defmodule MusicLibraryWeb.StatsLive.Index do import MusicLibraryWeb.ChartComponents import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1] import MusicLibraryWeb.StatsComponents - import MusicLibraryWeb.ScrobbleComponents, only: [refresh_lastfm_feed_button: 1] + import MusicLibraryWeb.ScrobbleComponents alias MusicLibrary.Assets.Transform alias MusicLibrary.{Collection, Records, ScrobbleActivity, Wishlist} diff --git a/lib/music_library_web/live/stats_live/index.html.heex b/lib/music_library_web/live/stats_live/index.html.heex index 0ff69232..9d838d9d 100644 --- a/lib/music_library_web/live/stats_live/index.html.heex +++ b/lib/music_library_web/live/stats_live/index.html.heex @@ -325,99 +325,7 @@ > {track.scrobbled_at_label} - <.tooltip> - <.icon - name="hero-information-circle" - class="h-5 w-5 text-zinc-500 dark:text-zinc-400 cursor-pointer" - aria-hidden="true" - data-slot="icon" - /> - <:content> -
-
-
{gettext("Track ID:")}
-
- - {track.musicbrainz_id || gettext("Unknown")} - - -
-
-
-
{gettext("Album ID:")}
-
- - {track.album.musicbrainz_id || gettext("Unknown")} - - -
-
-
-
{gettext("Artist ID:")}
-
- - {track.artist.musicbrainz_id || gettext("Unknown")} - - -
-
-
- - + <.track_metadata_tooltip track={track} /> diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 822ca7a7..baf71c89 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -836,6 +836,7 @@ msgid "Discogs data" msgstr "" #: lib/music_library_web/components/record_components.ex +#: lib/music_library_web/components/scrobble_components.ex #: lib/music_library_web/live/stats_live/index.html.heex #, elixir-autogen, elixir-format msgid "Unknown" @@ -923,32 +924,36 @@ msgstr "" msgid "All time" msgstr "" +#: lib/music_library_web/components/scrobble_components.ex #: lib/music_library_web/live/stats_live/index.html.heex #, elixir-autogen, elixir-format msgid "Album ID:" msgstr "" +#: lib/music_library_web/components/scrobble_components.ex #: lib/music_library_web/live/stats_live/index.html.heex #, elixir-autogen, elixir-format msgid "Artist ID:" msgstr "" +#: lib/music_library_web/components/scrobble_components.ex #: lib/music_library_web/live/stats_live/index.html.heex #, elixir-autogen, elixir-format msgid "Copy album MusicBrainz ID to clipboard" msgstr "" +#: lib/music_library_web/components/scrobble_components.ex #: lib/music_library_web/live/stats_live/index.html.heex #, elixir-autogen, elixir-format msgid "Copy artist MusicBrainz ID to clipboard" msgstr "" -#: lib/music_library_web/live/stats_live/index.html.heex +#: lib/music_library_web/components/scrobble_components.ex #, elixir-autogen, elixir-format msgid "Copy track MusicBrainz ID to clipboard" msgstr "" -#: lib/music_library_web/live/stats_live/index.html.heex +#: lib/music_library_web/components/scrobble_components.ex #, elixir-autogen, elixir-format msgid "Track ID:" msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index 16c8a14b..9de40f92 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -836,6 +836,7 @@ msgid "Discogs data" msgstr "" #: lib/music_library_web/components/record_components.ex +#: lib/music_library_web/components/scrobble_components.ex #: lib/music_library_web/live/stats_live/index.html.heex #, elixir-autogen, elixir-format msgid "Unknown" @@ -923,32 +924,36 @@ msgstr "" msgid "All time" msgstr "" +#: lib/music_library_web/components/scrobble_components.ex #: lib/music_library_web/live/stats_live/index.html.heex #, elixir-autogen, elixir-format, fuzzy msgid "Album ID:" msgstr "" +#: lib/music_library_web/components/scrobble_components.ex #: lib/music_library_web/live/stats_live/index.html.heex #, elixir-autogen, elixir-format msgid "Artist ID:" msgstr "" +#: lib/music_library_web/components/scrobble_components.ex #: lib/music_library_web/live/stats_live/index.html.heex #, elixir-autogen, elixir-format, fuzzy msgid "Copy album MusicBrainz ID to clipboard" msgstr "" +#: lib/music_library_web/components/scrobble_components.ex #: lib/music_library_web/live/stats_live/index.html.heex #, elixir-autogen, elixir-format, fuzzy msgid "Copy artist MusicBrainz ID to clipboard" msgstr "" -#: lib/music_library_web/live/stats_live/index.html.heex +#: lib/music_library_web/components/scrobble_components.ex #, elixir-autogen, elixir-format, fuzzy msgid "Copy track MusicBrainz ID to clipboard" msgstr "" -#: lib/music_library_web/live/stats_live/index.html.heex +#: lib/music_library_web/components/scrobble_components.ex #, elixir-autogen, elixir-format msgid "Track ID:" msgstr ""