Not working
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
defmodule MusicLibraryWeb.ArtistLive.Show do
|
||||
use MusicLibraryWeb, :live_view
|
||||
|
||||
alias MusicLibrary.Records
|
||||
|
||||
@impl true
|
||||
def mount(_params, _session, socket) do
|
||||
{:ok, socket}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_params(%{"musicbrainz_id" => musicbrainz_id}, _, socket) do
|
||||
{:ok, artist} = Records.get_artist(musicbrainz_id)
|
||||
|
||||
{:noreply,
|
||||
socket
|
||||
|> assign(:nav_section, :artists)
|
||||
|> assign(:artist, artist)
|
||||
|> assign(:page_title, page_title(socket.assigns.live_action, artist))}
|
||||
end
|
||||
|
||||
defp page_title(:show, artist) do
|
||||
Enum.join(
|
||||
[
|
||||
artist.name,
|
||||
"·",
|
||||
gettext("Details")
|
||||
],
|
||||
" "
|
||||
)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
<div class="mt-4 px-4">
|
||||
<h1 class="mt-1 flex font-semibold text-base sm:text-lg leading-5 text-zinc-700 dark:text-zinc-300 text-wrap">
|
||||
<%= @artist.name %>
|
||||
</h1>
|
||||
<p class="mt-2 text-sm leading-5 text-zinc-500 dark:text-zinc-400">
|
||||
<%= raw(@artist.bio) || gettext("Biography not available") %>
|
||||
</p>
|
||||
</div>
|
||||
@@ -45,6 +45,8 @@ defmodule MusicLibraryWeb.Router do
|
||||
|
||||
live "/wishlist/:id", WishlistLive.Show, :show
|
||||
live "/wishlist/:id/show/edit", WishlistLive.Show, :edit
|
||||
|
||||
live "/artists/:musicbrainz_id", ArtistLive.Show, :show
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user