diff --git a/lib/music_library_web/live/artist_live/show.ex b/lib/music_library_web/live/artist_live/show.ex index cb965d09..1378a59f 100644 --- a/lib/music_library_web/live/artist_live/show.ex +++ b/lib/music_library_web/live/artist_live/show.ex @@ -14,6 +14,34 @@ defmodule MusicLibraryWeb.ArtistLive.Show do """ end + attr :lastfm_artist_info, :map, required: true + + defp on_tour_link(assigns) do + ~H""" + + <.badge variant="pill" class="mr-2">{gettext("On Tour")} + + """ + end + + attr :play_count, :integer, required: true + + defp play_count(assigns) do + ~H""" + 0} class="text-xs font-medium text-zinc-700 dark:text-zinc-300 grow"> + {ngettext("1 scrobble", "%{count} scrobbles", @play_count)} + + + {gettext("No scrobbles")} + + """ + end + @impl true def mount(_params, _session, socket) do {:ok, socket} diff --git a/lib/music_library_web/live/artist_live/show.html.heex b/lib/music_library_web/live/artist_live/show.html.heex index e40e8c5c..19f4c096 100644 --- a/lib/music_library_web/live/artist_live/show.html.heex +++ b/lib/music_library_web/live/artist_live/show.html.heex @@ -22,26 +22,8 @@ {gettext("Error loading play count")} - - <.badge variant="pill" class="mr-2">{gettext("On Tour")} - - 0} - class="text-xs font-medium text-zinc-700 dark:text-zinc-300 grow" - > - {ngettext("1 scrobble", "%{count} scrobbles", lastfm_artist_info.play_count)} - - - {gettext("No scrobbles")} - + <.on_tour_link lastfm_artist_info={lastfm_artist_info} /> + <.play_count play_count={lastfm_artist_info.play_count} /> <.button variant="solid" as="link" patch={~p"/artists/#{@artist.musicbrainz_id}/import"}> <.icon name="hero-plus" class="h-4 w-4 mr-2" aria-hidden="true" data-slot="icon" /> diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 6fa78f9e..ed2a9518 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -429,7 +429,7 @@ msgstr "" msgid "Errors" msgstr "" -#: lib/music_library_web/live/artist_live/show.html.heex +#: lib/music_library_web/live/artist_live/show.ex #, elixir-autogen, elixir-format msgid "On Tour" msgstr "" @@ -441,7 +441,7 @@ msgid_plural "%{count} records" msgstr[0] "" msgstr[1] "" -#: lib/music_library_web/live/artist_live/show.html.heex +#: lib/music_library_web/live/artist_live/show.ex #, elixir-autogen, elixir-format msgid "1 scrobble" msgid_plural "%{count} scrobbles" @@ -692,7 +692,7 @@ msgstr "" msgid "Record wishlisted successfully" msgstr "" -#: lib/music_library_web/live/artist_live/show.html.heex +#: lib/music_library_web/live/artist_live/show.ex #, elixir-autogen, elixir-format msgid "No scrobbles" msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index bba99cf8..b7e7c110 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -429,7 +429,7 @@ msgstr "" msgid "Errors" msgstr "" -#: lib/music_library_web/live/artist_live/show.html.heex +#: lib/music_library_web/live/artist_live/show.ex #, elixir-autogen, elixir-format msgid "On Tour" msgstr "" @@ -441,7 +441,7 @@ msgid_plural "%{count} records" msgstr[0] "" msgstr[1] "" -#: lib/music_library_web/live/artist_live/show.html.heex +#: lib/music_library_web/live/artist_live/show.ex #, elixir-autogen, elixir-format msgid "1 scrobble" msgid_plural "%{count} scrobbles" @@ -692,7 +692,7 @@ msgstr "" msgid "Record wishlisted successfully" msgstr "" -#: lib/music_library_web/live/artist_live/show.html.heex +#: lib/music_library_web/live/artist_live/show.ex #, elixir-autogen, elixir-format msgid "No scrobbles" msgstr ""