diff --git a/lib/music_library_web/live/artist_live/show.ex b/lib/music_library_web/live/artist_live/show.ex index eed9b0b9..eab806b3 100644 --- a/lib/music_library_web/live/artist_live/show.ex +++ b/lib/music_library_web/live/artist_live/show.ex @@ -65,14 +65,15 @@ defmodule MusicLibraryWeb.ArtistLive.Show do socket |> assign(:nav_section, :artists) |> assign(:artist, artist) + |> assign(:artist_info, artist_info) |> assign(:country, ArtistInfo.country(artist_info)) |> stream(:collection_records, collection_records, reset: true) |> stream(:wishlist_records, wishlist_records, reset: true) |> assign(:collection_records_count, Enum.count(collection_records)) |> assign(:wishlist_records_count, Enum.count(wishlist_records)) - |> assign_async(:artist_info, fn -> - with {:ok, artist_info} <- LastFm.get_artist_info(artist.musicbrainz_id, artist.name) do - {:ok, %{artist_info: artist_info}} + |> assign_async(:lastfm_artist_info, fn -> + with {:ok, lastfm_artist_info} <- LastFm.get_artist_info(artist.musicbrainz_id, artist.name) do + {:ok, %{lastfm_artist_info: lastfm_artist_info}} end end) |> assign_async(:similar_artists, fn -> 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 16facd41..9b380551 100644 --- a/lib/music_library_web/live/artist_live/show.html.heex +++ b/lib/music_library_web/live/artist_live/show.html.heex @@ -6,7 +6,7 @@
- <.async_result :let={artist_info} assign={@artist_info}> + <.async_result :let={lastfm_artist_info} assign={@lastfm_artist_info}> <:loading>
{gettext("Loading play count")} @@ -29,17 +29,21 @@ {gettext("Error loading play count")}
- + <.round_badge text={gettext("On Tour")} class="mr-2" /> 0} + :if={lastfm_artist_info.play_count > 0} class="text-xs font-medium text-zinc-700 dark:text-zinc-300 grow" > - {ngettext("1 scrobble", "%{count} scrobbles", artist_info.play_count)} + {ngettext("1 scrobble", "%{count} scrobbles", lastfm_artist_info.play_count)} {gettext("No scrobbles")} @@ -69,11 +73,11 @@ {@artist.name} ~p"/images/cover-not-found.png" <> "';"} /> - <.async_result :let={artist_info} assign={@artist_info}> + <.async_result :let={lastfm_artist_info} assign={@lastfm_artist_info}> <:loading>
{gettext("Loading biography")} @@ -91,11 +95,11 @@
{gettext("Biography")} - {render_bio(@artist_info.result.summary)} + {render_bio(@lastfm_artist_info.result.summary)}