From 6c5a0f89fcf96dbc7b311b0c96bfa9e7092ba980 Mon Sep 17 00:00:00 2001 From: irrlicht Date: Fri, 30 Oct 2026 22:30:40 +0100 Subject: [PATCH] =?UTF-8?q?Suche:=20eigene=20Seite=20mit=20Filtern=20f?= =?UTF-8?q?=C3=BCr=20Text,=20Nutzer=20und=20Hashtags?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Grundlage für Suche, Profil-Feed und künftige Hashtag-Links ist ein gemeinsamer Beitragsfilter (internal/httpapi/search.go): alle Wörter im Text, Autor, ganze Hashtags, wahlweise nur Wurzelbeiträge. Der Profil-Feed läuft jetzt darüber; bei gleicher Sekunde sortiert er nach Anlegezeitpunkt (id) statt nach der zufälligen pid. /search ersetzt den Platzhalter und steht in der Navigation. Die Filter stehen in der Adresse, so lässt sich eine Suche verlinken. Co-Authored-By: Claude Opus 5.5 --- frontend/src/Nav.tsx | 2 +- frontend/src/components/Feed.tsx | 8 +- frontend/src/docs/info.html | 4 + frontend/src/main.tsx | 3 +- frontend/src/pages/Placeholder.tsx | 4 +- frontend/src/pages/SearchPage.tsx | 64 +++++++++++++++ internal/httpapi/entries.go | 2 +- internal/httpapi/search.go | 124 +++++++++++++++++++++++++++++ internal/httpapi/search_test.go | 61 ++++++++++++++ internal/httpapi/server.go | 1 + notes/api.md | 14 ++++ 11 files changed, 280 insertions(+), 7 deletions(-) create mode 100644 frontend/src/pages/SearchPage.tsx create mode 100644 internal/httpapi/search.go create mode 100644 internal/httpapi/search_test.go diff --git a/frontend/src/Nav.tsx b/frontend/src/Nav.tsx index a4a9315..f2fb214 100644 --- a/frontend/src/Nav.tsx +++ b/frontend/src/Nav.tsx @@ -10,7 +10,7 @@ type Target = { title: string; icon?: ReactNode; to: string; end?: boolean; badg // Bereiche, die es noch nicht gibt: Route und Platzhalter-Seite bestehen, // in der Navigation sind sie bis dahin ausgeblendet. -const unfinished = new Set(["/search", "/notifications"]); +const unfinished = new Set(["/notifications"]); export const isReady = (to: string) => !unfinished.has(to); diff --git a/frontend/src/components/Feed.tsx b/frontend/src/components/Feed.tsx index bf2c2a6..8269883 100644 --- a/frontend/src/components/Feed.tsx +++ b/frontend/src/components/Feed.tsx @@ -24,12 +24,14 @@ function scrollBelowHeader(el: Element) { window.scrollTo({ top: el.getBoundingClientRect().top + window.scrollY - offset }); } -export function Feed({ queryKey, urlFor, as: Container = "section", focus, onFocused }: { +// empty ersetzt bei einem ganz leeren Ergebnis die Endmarke (Suche). +export function Feed({ queryKey, urlFor, as: Container = "section", focus, onFocused, empty }: { queryKey: unknown[]; urlFor: (page: number) => string; as?: "section" | "div"; focus?: number; onFocused?: () => void; + empty?: string; }) { const feed = useInfiniteQuery({ queryKey, @@ -85,7 +87,9 @@ export function Feed({ queryKey, urlFor, as: Container = "section", focus, onFoc {entries.map((e) => )} {feed.isError &&

{errMsg(feed.error, "Feed konnte nicht geladen werden.")}

} - {feed.isSuccess && !hasNextPage &&

YOU REACHED THE END!

} + {feed.isSuccess && !hasNextPage && ( +

{empty && !entries.length ? empty : "YOU REACHED THE END!"}

+ )}
diff --git a/frontend/src/docs/info.html b/frontend/src/docs/info.html index ba77ad9..913218e 100644 --- a/frontend/src/docs/info.html +++ b/frontend/src/docs/info.html @@ -15,6 +15,10 @@

Changelog

+

30.10.2026

+

13.10.2026