From b7d1d2ec9a0586e0f32727f4af3c630dc7d24593 Mon Sep 17 00:00:00 2001 From: Till JS Date: Thu, 26 Mar 2026 20:30:04 +0100 Subject: [PATCH] feat(zitare): add category filter chips to search results Show clickable category pills below the search input when results are available. Each chip shows the match count for that category. Also respects display settings for category/source visibility. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../apps/web/src/lib/i18n/locales/de.json | 4 +- .../apps/web/src/lib/i18n/locales/en.json | 4 +- .../web/src/routes/(app)/search/+page.svelte | 84 +++++++++++++++++-- 3 files changed, 81 insertions(+), 11 deletions(-) diff --git a/apps/zitare/apps/web/src/lib/i18n/locales/de.json b/apps/zitare/apps/web/src/lib/i18n/locales/de.json index 0ccc2604b..2f6849c5b 100644 --- a/apps/zitare/apps/web/src/lib/i18n/locales/de.json +++ b/apps/zitare/apps/web/src/lib/i18n/locales/de.json @@ -110,7 +110,9 @@ "createList": "als Liste erstellen", "createListDescription": "Neue Liste mit diesem Namen erstellen", "minChars": "Bitte gib mindestens 2 Zeichen ein", - "hint": "Suche nach Zitaten, Autoren oder Themen" + "hint": "Suche nach Zitaten, Autoren oder Themen", + "allCategories": "Alle", + "filterByCategory": "Nach Kategorie filtern" }, "settings": { "quoteLanguage": "Zitat-Sprache", diff --git a/apps/zitare/apps/web/src/lib/i18n/locales/en.json b/apps/zitare/apps/web/src/lib/i18n/locales/en.json index ae45c583c..ee9b9fd53 100644 --- a/apps/zitare/apps/web/src/lib/i18n/locales/en.json +++ b/apps/zitare/apps/web/src/lib/i18n/locales/en.json @@ -110,7 +110,9 @@ "createList": "create as list", "createListDescription": "Create a new list with this name", "minChars": "Please enter at least 2 characters", - "hint": "Search for quotes, authors, or topics" + "hint": "Search for quotes, authors, or topics", + "allCategories": "All", + "filterByCategory": "Filter by category" }, "settings": { "quoteLanguage": "Quote language", diff --git a/apps/zitare/apps/web/src/routes/(app)/search/+page.svelte b/apps/zitare/apps/web/src/routes/(app)/search/+page.svelte index a5ede917f..0c19b5216 100644 --- a/apps/zitare/apps/web/src/routes/(app)/search/+page.svelte +++ b/apps/zitare/apps/web/src/routes/(app)/search/+page.svelte @@ -1,25 +1,55 @@ @@ -30,7 +60,7 @@

{$_('search.title')}

-
+
{#if searchTerm}
+ + {#if searchTerm.length >= 2 && results.length > 0} +
+ + {#each categories as cat} + {@const matchCount = searchQuotes(searchTerm, quotesStore.language).filter( + (q) => q.category === cat.name + ).length} + {#if matchCount > 0} + + {/if} + {/each} +
+ {/if} + {#if searchTerm.length >= 2} {#if results.length === 0} @@ -93,7 +155,11 @@

{#each results as quote (quote.id)} - + {/each}
{/if}