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 defmodule MusicLibraryWeb.StatsHTML do
use MusicLibraryWeb, :html use MusicLibraryWeb, :html
import MusicLibraryWeb.ArtistHelpers
alias MusicLibrary.Records.Record alias MusicLibrary.Records.Record
embed_templates "stats_html/*" embed_templates "stats_html/*"
@@ -16,9 +16,13 @@
</dt> </dt>
<dd class="ml-24 flex items-baseline pb-6 sm:pb-7"> <dd class="ml-24 flex items-baseline pb-6 sm:pb-7">
<p class="font-semibold"> <p class="font-semibold">
<span class="text-sm md:text-base lg:text-2xl text-gray-900"> <.link
<%= format_artist_names(@latest_record.artists) %> :for={artist <- @latest_record.artists}
</span> 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"> <span class="text-sm md:text-base block text-gray-600">
<%= @latest_record.title %> <%= @latest_record.title %>
</span> </span>
@@ -49,6 +49,7 @@
<p class="text-sm max-sm:text-xs"> <p class="text-sm max-sm:text-xs">
<.link <.link
:for={artist <- record.artists} :for={artist <- record.artists}
class=" hover:text-gray-500"
patch={~p"/records?query=mbid:#{artist.musicbrainz_id}"} patch={~p"/records?query=mbid:#{artist.musicbrainz_id}"}
> >
<%= artist.name %> <%= artist.name %>
@@ -1,6 +1,5 @@
defmodule MusicLibraryWeb.RecordLive.Show do defmodule MusicLibraryWeb.RecordLive.Show do
use MusicLibraryWeb, :live_view use MusicLibraryWeb, :live_view
import MusicLibraryWeb.ArtistHelpers
alias MusicLibrary.Records alias MusicLibrary.Records
@@ -1,5 +1,11 @@
<.header> <.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> <:subtitle>
<%= @record.title %> <%= @record.title %>
</:subtitle> </:subtitle>