From b4e08ac5e3cf011092effd2bea09d49f4cf6031e Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Tue, 12 May 2026 07:49:14 -0600 Subject: [PATCH] feat(discovery-v2): wire add-to-playlist + songlink share to album quick menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Completes the AlbumQuickMenu surface with the two remaining actions the parent already passes through Props but Discovery hadn't been forwarding: - Add to Playlist (onAddAlbumToPlaylist → onAddToPlaylist on the menu): opens the parent's add-to-playlist modal. - Share Songlink (onAlbumShareSonglink → onShareSonglink): copies the Songlink URL to the clipboard via the parent's existing flow. i18n: adds `actions.shareSonglink` ("Share (Songlink)") across the five locales. `actions.addToPlaylist` already existed and is reused. The two actions render only when the corresponding callback is passed, so cards on sections that don't wire them (no current case) silently omit the items. Reuses the same AlbumQuickMenu instance — no new component, just two extra optional props forwarded through AlbumCardLite. This sets up the shared menu surface that the upcoming AlbumRowLite kebab will reuse for the Top Albums section, avoiding duplicate menu logic across cards. cc --- src/lib/discovery-v2/AlbumCardLite.svelte | 6 ++++++ src/lib/discovery-v2/AlbumQuickMenu.svelte | 10 +++++++++- src/lib/discovery-v2/DiscoveryView.svelte | 4 ++++ src/lib/i18n/locales/de.json | 1 + src/lib/i18n/locales/en.json | 1 + src/lib/i18n/locales/es.json | 1 + src/lib/i18n/locales/fr.json | 1 + src/lib/i18n/locales/pt.json | 1 + 8 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/lib/discovery-v2/AlbumCardLite.svelte b/src/lib/discovery-v2/AlbumCardLite.svelte index d47f8c940..7cfb3a45a 100644 --- a/src/lib/discovery-v2/AlbumCardLite.svelte +++ b/src/lib/discovery-v2/AlbumCardLite.svelte @@ -22,7 +22,9 @@ onFavorite?: () => void; onPlayNext?: () => void; onPlayLater?: () => void; + onAddToPlaylist?: () => void; onShareQobuz?: () => void; + onShareSonglink?: () => void; onDownload?: () => void; } @@ -43,7 +45,9 @@ onFavorite, onPlayNext, onPlayLater, + onAddToPlaylist, onShareQobuz, + onShareSonglink, onDownload, }: Props = $props(); @@ -149,9 +153,11 @@ onClose={() => (menuOpen = false)} onPlayNext={onPlayNext ? () => onPlayNext?.() : undefined} onPlayLater={onPlayLater ? () => onPlayLater?.() : undefined} + onAddToPlaylist={onAddToPlaylist ? () => onAddToPlaylist?.() : undefined} onGoToAlbum={onClick ? () => onClick?.() : undefined} onGoToArtist={onArtistClick ? () => onArtistClick?.() : undefined} onShareQobuz={onShareQobuz ? () => onShareQobuz?.() : undefined} + onShareSonglink={onShareSonglink ? () => onShareSonglink?.() : undefined} onDownload={onDownload ? () => onDownload?.() : undefined} /> diff --git a/src/lib/discovery-v2/AlbumQuickMenu.svelte b/src/lib/discovery-v2/AlbumQuickMenu.svelte index b53fab63d..188fd9ad5 100644 --- a/src/lib/discovery-v2/AlbumQuickMenu.svelte +++ b/src/lib/discovery-v2/AlbumQuickMenu.svelte @@ -8,6 +8,8 @@ User, Share2, Download, + Plus, + Link as LinkIcon, } from 'lucide-svelte'; import { openMenu as openGlobalMenu, @@ -23,9 +25,11 @@ onClose: () => void; onPlayNext?: () => void; onPlayLater?: () => void; + onAddToPlaylist?: () => void; onGoToAlbum?: () => void; onGoToArtist?: () => void; onShareQobuz?: () => void; + onShareSonglink?: () => void; onDownload?: () => void; } @@ -35,9 +39,11 @@ onClose, onPlayNext, onPlayLater, + onAddToPlaylist, onGoToAlbum, onGoToArtist, onShareQobuz, + onShareSonglink, onDownload, }: Props = $props(); @@ -113,9 +119,11 @@ const items = $derived([ onPlayNext ? { labelKey: 'actions.playNext', icon: ListPlus, run: () => fire(onPlayNext) } : null, onPlayLater ? { labelKey: 'actions.playLater', icon: ListEnd, run: () => fire(onPlayLater) } : null, + onAddToPlaylist ? { labelKey: 'actions.addToPlaylist', icon: Plus, run: () => fire(onAddToPlaylist) } : null, onGoToAlbum ? { labelKey: 'actions.goToAlbum', icon: Disc, run: () => fire(onGoToAlbum) } : null, onGoToArtist ? { labelKey: 'actions.goToArtist', icon: User, run: () => fire(onGoToArtist) } : null, - onShareQobuz ? { labelKey: 'actions.share', icon: Share2, run: () => fire(onShareQobuz) } : null, + onShareQobuz ? { labelKey: 'actions.shareQobuz', icon: Share2, run: () => fire(onShareQobuz) } : null, + onShareSonglink ? { labelKey: 'actions.shareSonglink', icon: LinkIcon, run: () => fire(onShareSonglink) } : null, onDownload ? { labelKey: 'actions.download', icon: Download, run: () => fire(onDownload) } : null, ].filter((item): item is NonNullable => item !== null)); diff --git a/src/lib/discovery-v2/DiscoveryView.svelte b/src/lib/discovery-v2/DiscoveryView.svelte index bd4b6d929..15027e263 100644 --- a/src/lib/discovery-v2/DiscoveryView.svelte +++ b/src/lib/discovery-v2/DiscoveryView.svelte @@ -108,7 +108,9 @@ onAlbumPlayNext, onAlbumPlayLater, onAlbumShareQobuz, + onAlbumShareSonglink, onAlbumDownload, + onAddAlbumToPlaylist, onArtistClick, onTrackPlay, onTrackGoToAlbum, @@ -274,7 +276,9 @@ : undefined} onPlayNext={onAlbumPlayNext ? () => onAlbumPlayNext?.(album.albumId) : undefined} onPlayLater={onAlbumPlayLater ? () => onAlbumPlayLater?.(album.albumId) : undefined} + onAddToPlaylist={onAddAlbumToPlaylist ? () => onAddAlbumToPlaylist?.(album.albumId) : undefined} onShareQobuz={onAlbumShareQobuz ? () => onAlbumShareQobuz?.(album.albumId) : undefined} + onShareSonglink={onAlbumShareSonglink ? () => onAlbumShareSonglink?.(album.albumId) : undefined} onDownload={onAlbumDownload ? () => onAlbumDownload?.(album.albumId) : undefined} /> {/snippet} diff --git a/src/lib/i18n/locales/de.json b/src/lib/i18n/locales/de.json index 1583706bf..df138172c 100644 --- a/src/lib/i18n/locales/de.json +++ b/src/lib/i18n/locales/de.json @@ -85,6 +85,7 @@ "expand": "Seitenleiste ausklappen", "moreOptions": "Weitere Optionen", "shareQobuz": "Teilen (Qobuz)", + "shareSonglink": "Teilen (Songlink)", "refreshOfflineCopy": "Offline-Kopie aktualisieren", "albumCredits": "Album-Credits", "startArtistRadio": "Künstler-Radio starten", diff --git a/src/lib/i18n/locales/en.json b/src/lib/i18n/locales/en.json index d2d085af3..382cf36f8 100644 --- a/src/lib/i18n/locales/en.json +++ b/src/lib/i18n/locales/en.json @@ -87,6 +87,7 @@ "expand": "Expand sidebar", "moreOptions": "More options", "shareQobuz": "Share (Qobuz)", + "shareSonglink": "Share (Songlink)", "albumCredits": "Album credits", "startArtistRadio": "Start Artist Radio", "radio": { diff --git a/src/lib/i18n/locales/es.json b/src/lib/i18n/locales/es.json index 239ce9495..7154e1c51 100644 --- a/src/lib/i18n/locales/es.json +++ b/src/lib/i18n/locales/es.json @@ -86,6 +86,7 @@ "expand": "Expandir barra lateral", "moreOptions": "Más opciones", "shareQobuz": "Compartir (Qobuz)", + "shareSonglink": "Compartir (Songlink)", "albumCredits": "Créditos del álbum", "radio": { "startArtistRadio": "Iniciar Artist Radio" diff --git a/src/lib/i18n/locales/fr.json b/src/lib/i18n/locales/fr.json index f24bbba00..626f2dbe9 100644 --- a/src/lib/i18n/locales/fr.json +++ b/src/lib/i18n/locales/fr.json @@ -86,6 +86,7 @@ "expand": "Développer la barre latérale", "moreOptions": "Plus d'options", "shareQobuz": "Partager (Qobuz)", + "shareSonglink": "Partager (Songlink)", "albumCredits": "Crédits de l'album", "radio": { "startArtistRadio": "Lancer la radio de l'artiste" diff --git a/src/lib/i18n/locales/pt.json b/src/lib/i18n/locales/pt.json index e8c1ddc92..01e100cc1 100644 --- a/src/lib/i18n/locales/pt.json +++ b/src/lib/i18n/locales/pt.json @@ -85,6 +85,7 @@ "expand": "Expandir barra lateral", "moreOptions": "Mais opções", "shareQobuz": "Compartilhar (Qobuz)", + "shareSonglink": "Compartilhar (Songlink)", "refreshOfflineCopy": "Atualizar cópia offline", "albumCredits": "Créditos do álbum", "startArtistRadio": "Iniciar Rádio do Artista",