Refactor Release component to take release_id

This commit is contained in:
Claudio Ortolina
2026-04-23 08:03:36 +01:00
parent 0d1f580379
commit 4c48bda7b2
5 changed files with 274 additions and 181 deletions
@@ -292,13 +292,21 @@ defmodule MusicLibraryWeb.CollectionLive.Show do
<.record_debug_sheet record={@record} embedding_text={@embedding_text} />
<.live_component
id="release-with-tracks"
sheet_id="release-with-tracks-sheet"
module={MusicLibraryWeb.Components.Release}
record={@record}
timezone={@timezone}
/>
<.sheet
:if={@record.selected_release_id}
id="release-with-tracks-sheet"
placement="right"
class="flex min-w-xs flex-col overflow-hidden p-0 sm:min-w-sm"
>
<.live_component
id="release-with-tracks"
sheet_id="release-with-tracks-sheet"
module={MusicLibraryWeb.Components.Release}
release_id={@record.selected_release_id}
show_print?={true}
timezone={@timezone}
/>
</.sheet>
<.live_component
id="record-notes"
@@ -1,7 +1,7 @@
defmodule MusicLibraryWeb.ScrobbleLive.Show do
use MusicLibraryWeb, :live_view
import(MusicLibraryWeb.Components.Release, only: [medium: 1, scrobble_button_label: 1])
import(MusicLibraryWeb.Components.Release, only: [medium: 1])
import MusicLibraryWeb.RecordComponents, only: [country_label: 1]
alias MusicLibrary.ScrobbleActivity
@@ -103,7 +103,11 @@ defmodule MusicLibraryWeb.ScrobbleLive.Show do
else: "scrobble_release"
}
>
<span class="sr-only">{scrobble_button_label(@selected_tracks)}</span>
<span class="sr-only">
{if MapSet.size(@selected_tracks) > 0,
do: gettext("Scrobble selected tracks"),
else: gettext("Scrobble release")}
</span>
<.icon name="hero-play" class="icon" aria-hidden="true" data-slot="icon" />
</.button>
</div>
@@ -117,6 +121,7 @@ defmodule MusicLibraryWeb.ScrobbleLive.Show do
selected_tracks={@selected_tracks}
media_count={MusicBrainz.Release.media_count(@release)}
myself={nil}
show_print?={false}
/>
</.form>
</div>