From 6e1b0916a6cd7ebbee3b06935ce72f9ae96924ec Mon Sep 17 00:00:00 2001 From: Stommer Date: Sun, 25 Oct 2026 07:13:59 +0100 Subject: [PATCH] =?UTF-8?q?Erleichtere=20die=20Tag-Auswahl=20der=20Paperle?= =?UTF-8?q?ss-Suche=20mit=20Suchfeld,=20Alle-an-/abw=C3=A4hlen=20und=20Chi?= =?UTF-8?q?ps=20f=C3=BCr=20die=20gew=C3=A4hlten=20Tags.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- frontend/src/pages/Sources.jsx | 41 ++++++++++++++++++++++++++++++++-- frontend/src/styles.css | 3 +++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/Sources.jsx b/frontend/src/pages/Sources.jsx index e6d5c0f..4d40b5e 100644 --- a/frontend/src/pages/Sources.jsx +++ b/frontend/src/pages/Sources.jsx @@ -308,6 +308,7 @@ export function PaperlessPicker({ context, placement, chapterId = "", chapterTit const [pending, setPending] = useState(false); const [error, setError] = useState(""); // The filters sit beside the hits on a wide screen. On a phone they start folded away. + const [tagSearch, setTagSearch] = useState(""); const [moreOpen, setMoreOpen] = useState(() => typeof window === "undefined" || !window.matchMedia || window.matchMedia("(min-width: 900px)").matches); const searchRef = useRef(0); const previewRef = useRef(0); @@ -524,6 +525,16 @@ export function PaperlessPicker({ context, placement, chapterId = "", chapterTit setFilters((current) => ({ ...current, mode, sort: current.sort === "-score" && mode !== "index" ? "-created" : current.sort })); } + const visibleTags = facets.tags.filter((item) => item.name.toLocaleLowerCase().includes(tagSearch.trim().toLocaleLowerCase())); + + function tagName(id) { + return facets.tags.find((item) => item.id === id)?.name || id; + } + + function selectTags(ids) { + setFilters((current) => ({ ...current, tags: [...new Set([...current.tags, ...ids])] })); + } + function toggleTag(id) { setFilters((current) => { const tags = current.tags.includes(id) ? current.tags.filter((item) => item !== id) : [...current.tags, id]; @@ -616,13 +627,39 @@ export function PaperlessPicker({ context, placement, chapterId = "", chapterTit + {filters.tags.length ? ( + + ) : null} + {facets.tags.length ? ( + <> + setTagSearch(event.target.value)} placeholder="Tags suchen" aria-label="Tags suchen" /> +
+ + +
+ + ) : null}
- {facets.tags.length ? facets.tags.map((item) => ( + {visibleTags.map((item) => ( - )) :

Keine Tags an diesem Zugang.

} + ))} + {!facets.tags.length ?

Keine Tags an diesem Zugang.

: null} + {facets.tags.length && !visibleTags.length ?

Kein Tag passt zur Suche.

: null}