From 90be0c6538fbc5b102d32c66815daca4d1b3dfb5 Mon Sep 17 00:00:00 2001 From: XShine555 Date: Thu, 16 Jul 2026 17:36:36 +0200 Subject: [PATCH] fix(frontend): extend add-to-playlist context menu to local Musify tracks Right-clicking a local track in the Musify section now opens the same nested add-to-playlist menu as YouTube results. Also switched the playlist thumbnail corners to rounded-lg. --- .../src/routes/(app)/explore/+page.svelte | 41 +++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/frontend/src/routes/(app)/explore/+page.svelte b/frontend/src/routes/(app)/explore/+page.svelte index c1cebfb..484a3b3 100644 --- a/frontend/src/routes/(app)/explore/+page.svelte +++ b/frontend/src/routes/(app)/explore/+page.svelte @@ -20,6 +20,15 @@ isExplicit: boolean; } + interface LocalTrackTarget { + id: string; + title: string; + } + + type ContextMenuTarget = + | { kind: 'youtube'; song: YouTubeSong } + | { kind: 'local'; track: LocalTrackTarget }; + let { data, form } = $props(); let searchValue = $state(data.query); @@ -28,7 +37,7 @@ let ytItems = $state([]); let ytContinuation = $state(''); let ytLoadingMore = $state(false); - let contextMenu = $state<{ song: YouTubeSong; x: number; y: number; openLeft: boolean } | null>( + let contextMenu = $state<(ContextMenuTarget & { x: number; y: number; openLeft: boolean }) | null>( null ); @@ -102,13 +111,13 @@ ); } - function openContextMenu(event: MouseEvent, song: YouTubeSong) { + function openContextMenu(event: MouseEvent, target: ContextMenuTarget) { if (data.playlists.length === 0) return; event.preventDefault(); const menuWidth = 208; const submenuWidth = 224; contextMenu = { - song, + ...target, x: Math.min(event.clientX, window.innerWidth - menuWidth - 8), y: Math.min(event.clientY, window.innerHeight - 60), openLeft: event.clientX + menuWidth + submenuWidth + 16 > window.innerWidth @@ -196,7 +205,11 @@ {:else}