From 0b964c9697adecfa39c07573660001f15e1fa757 Mon Sep 17 00:00:00 2001 From: wlkns-dev Date: Mon, 9 Nov 2026 18:12:57 +0100 Subject: [PATCH] =?UTF-8?q?Leisten-Dropdowns=20in=20Design:=20Sort-/Gruppi?= =?UTF-8?q?eren-Iconkn=C3=B6pfe=20mit=20thematischen=20Popover-Men=C3=BCs?= =?UTF-8?q?=20(=E2=9C=93-Markierung,=20akkordierter=20Akzent=20statt=20GTK?= =?UTF-8?q?-Grau)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.svelte | 93 ++++++++++++++++++++++++++++++++++----------- src/app.css | 45 ++++++++++++++++++++++ src/lib/Icon.svelte | 16 ++++++++ 3 files changed, 132 insertions(+), 22 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index 6ed8eb1..d2260bc 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -327,6 +327,36 @@ .sort((a, b) => a.key.localeCompare(b.key, 'de')) }) + let menuOpen = $state<'sort' | 'group' | null>(null) + + const SORTS: { key: SortKey; label: string; icon: string }[] = [ + { key: 'added', label: 'Zuletzt hinzugefügt', icon: 'clock' }, + { key: 'title', label: 'Titel A–Z', icon: 'alpha' }, + { key: 'author', label: 'Autor', icon: 'user' }, + { key: 'runtime', label: 'Laufzeit', icon: 'hourglass' }, + { key: 'percent', label: 'Fortschritt', icon: 'chart' }, + ] + const GROUPS: { key: typeof groupBy; label: string; icon: string }[] = [ + { key: 'aus', label: 'Gruppieren: aus', icon: 'x' }, + { key: 'autor', label: 'nach Autor', icon: 'user' }, + { key: 'serie', label: 'nach Serie', icon: 'stack' }, + { key: 'genre', label: 'nach Genre', icon: 'tag' }, + ] + + const sortIcon = $derived(SORTS.find((o) => o.key === sortBy)?.icon ?? 'clock') + const sortLabel = $derived('Sortierung: ' + (SORTS.find((o) => o.key === sortBy)?.label ?? '')) + const groupLabel = $derived( + groupBy === 'aus' + ? 'Gruppieren: aus' + : 'Gruppierung: ' + (GROUPS.find((o) => o.key === groupBy)?.label ?? '') + ) + + // Schließen bei Klick außerhalb + function onDocClick(ev: MouseEvent): void { + const t = ev.target as HTMLElement | null + if (!t?.closest('.hwdropdown') && menuOpen) menuOpen = null + } + async function loadSeries(): Promise { if (seriesLoaded || seriesLoading || groupBy !== 'serie') return seriesLoading = true @@ -609,6 +639,7 @@ } } window.addEventListener('keydown', onKey) + document.addEventListener('click', onDocClick) checkAuth() const unlistenLogin = onLoginUrl((u) => { loginUrl = u }) const unlisten = onDownloadUpdate((it) => { @@ -636,6 +667,7 @@ clearPoll() clearInterval(syncId) window.removeEventListener('keydown', onKey) +document.removeEventListener('click', onDocClick) unlisten.then((f) => f()) unlistenPlayer.then((f) => f()) unlistenLogin.then((f: () => void) => f()) @@ -723,28 +755,45 @@ placeholder="Suche Titel, Autor, Sprecher…" bind:value={query} /> - - +
+ + {#if menuOpen === 'sort'} + + {/if} +
+
+ + {#if menuOpen === 'group'} + + {/if} +