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}