diff --git a/src/lib/Library.svelte b/src/lib/Library.svelte index da0be7b..623ed45 100644 --- a/src/lib/Library.svelte +++ b/src/lib/Library.svelte @@ -60,6 +60,7 @@ type SectionRow = { label: string; expanded: boolean; toggle: () => void; + onAdd?: () => void; }; type StatusRow = { @@ -108,14 +109,8 @@ let menu = $state<{ } | null>(null); let libraryElement = $state(); let virtualizer = $state(); -let headerHeight = $state(0); -// HACK: masked ancestor prevents backdrop-filter from -// sampling properly so just disabling it temporarily -// when search help is visible appears to work fine const scrollFadeEnabled = $derived( - settings.transparentOutlines && - !prefersReducedTransparency.current && - !searchHelpVisible, + settings.transparentOutlines && !prefersReducedTransparency.current, ); const albumTypeAliases: Record = { @@ -376,6 +371,7 @@ function appendSection( label: string, items: ItemRow[], section: SectionName, + onAdd?: () => void, ) { const isExpanded = expanded[section]; rows.push({ @@ -392,6 +388,7 @@ function appendSection( animateTreeExpansion(libraryElement, key, positions); else if (lib.focusedId?.startsWith(`${key}/`)) lib.focusedId = key; }, + onAdd, }); if (isExpanded) for (const item of items) appendItem(rows, item); } @@ -458,6 +455,14 @@ function buildRows(): LibraryRow[] { t(`common.${type}s` as const), itemRows, sectionKey, + type === "song" + ? () => { + const songs = itemRows.flatMap(({ track }) => + track && canPlayTrack(track) ? [track] : [], + ); + if (songs.length) insertAt(queue.tracks.length, songs); + } + : undefined, ); } return rows; @@ -737,11 +742,8 @@ function onKey(event: KeyboardEvent) { {#if menu} @@ -874,14 +883,22 @@ function onKey(event: KeyboardEvent) {