Add more artist links with correct style

This commit is contained in:
Claudio Ortolina
2024-10-15 23:03:20 +01:00
parent 6e3300429b
commit 0218f8223c
6 changed files with 15 additions and 14 deletions
-7
View File
@@ -1,7 +0,0 @@
defmodule MusicLibraryWeb.ArtistHelpers do
def format_artist_names(artists) do
artists
|> Enum.map(fn a -> a.name end)
|> Enum.join(", ")
end
end
@@ -1,8 +1,6 @@
defmodule MusicLibraryWeb.StatsHTML do
use MusicLibraryWeb, :html
import MusicLibraryWeb.ArtistHelpers
alias MusicLibrary.Records.Record
embed_templates "stats_html/*"
@@ -16,9 +16,13 @@
</dt>
<dd class="ml-24 flex items-baseline pb-6 sm:pb-7">
<p class="font-semibold">
<span class="text-sm md:text-base lg:text-2xl text-gray-900">
<%= format_artist_names(@latest_record.artists) %>
</span>
<.link
:for={artist <- @latest_record.artists}
class="text-sm md:text-base lg:text-2xl text-gray-900 hover:text-gray-500"
patch={~p"/records?query=mbid:#{artist.musicbrainz_id}"}
>
<%= artist.name %>
</.link>
<span class="text-sm md:text-base block text-gray-600">
<%= @latest_record.title %>
</span>
@@ -49,6 +49,7 @@
<p class="text-sm max-sm:text-xs">
<.link
:for={artist <- record.artists}
class=" hover:text-gray-500"
patch={~p"/records?query=mbid:#{artist.musicbrainz_id}"}
>
<%= artist.name %>
@@ -1,6 +1,5 @@
defmodule MusicLibraryWeb.RecordLive.Show do
use MusicLibraryWeb, :live_view
import MusicLibraryWeb.ArtistHelpers
alias MusicLibrary.Records
@@ -1,5 +1,11 @@
<.header>
<%= format_artist_names(@record.artists) %>
<.link
:for={artist <- @record.artists}
class=" hover:text-gray-500"
patch={~p"/records?query=mbid:#{artist.musicbrainz_id}"}
>
<%= artist.name %>
</.link>
<:subtitle>
<%= @record.title %>
</:subtitle>