diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index 29e04ff..6e37c9a 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -8,6 +8,7 @@ import { EyeOff, GripVertical, Pencil, + RefreshCw, RotateCcw, X, } from "lucide-react"; @@ -48,6 +49,9 @@ const SORT_IDS = [ const SHOW_IDS = ["unwatched", "in_progress", "all", "watched", "saved", "hidden"]; +// Fresh shuffle token for the "surprise me" sort. +const rollSeed = () => Math.floor(Math.random() * 1_000_000_000); + const DATE_PRESETS: { days: number; key: string }[] = [ { days: 1, key: "24h" }, { days: 7, key: "1week" }, @@ -215,17 +219,38 @@ export default function Sidebar({ ); case "sort": return ( - +
+ + {filters.sort === "shuffle" && ( + + )} +
); case "date": return ( diff --git a/frontend/src/i18n/locales/de/sidebar.json b/frontend/src/i18n/locales/de/sidebar.json index 18ce833..221aa2f 100644 --- a/frontend/src/i18n/locales/de/sidebar.json +++ b/frontend/src/i18n/locales/de/sidebar.json @@ -23,6 +23,7 @@ "from": "Von", "to": "Bis", "clearDates": "Daten löschen", + "reshuffle": "Neu mischen", "widget": { "show": "Anzeigen", "sort": "Sortierung", diff --git a/frontend/src/i18n/locales/en/sidebar.json b/frontend/src/i18n/locales/en/sidebar.json index 2e42985..152f7b9 100644 --- a/frontend/src/i18n/locales/en/sidebar.json +++ b/frontend/src/i18n/locales/en/sidebar.json @@ -23,6 +23,7 @@ "from": "From", "to": "To", "clearDates": "clear dates", + "reshuffle": "Reshuffle", "widget": { "show": "Show", "sort": "Sort", diff --git a/frontend/src/i18n/locales/hu/sidebar.json b/frontend/src/i18n/locales/hu/sidebar.json index 5390f0b..5c5cc0e 100644 --- a/frontend/src/i18n/locales/hu/sidebar.json +++ b/frontend/src/i18n/locales/hu/sidebar.json @@ -23,6 +23,7 @@ "from": "Ettől", "to": "Eddig", "clearDates": "dátumok törlése", + "reshuffle": "Újrakeverés", "widget": { "show": "Megjelenítés", "sort": "Rendezés", diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index 2bf9319..95a9c43 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -73,6 +73,9 @@ export interface FeedFilters { tagMode: "or" | "and"; q: string; sort: string; + // Re-roll token for the "shuffle" sort; bumped by the reshuffle button so the + // feed re-queries with a fresh order. Ignored by every other sort. + seed?: number; includeNormal: boolean; includeShorts: boolean; includeLive: boolean; @@ -153,6 +156,7 @@ function feedQuery(f: FeedFilters, offset: number, limit: number): string { p.set("tag_mode", f.tagMode); if (f.q) p.set("q", f.q); p.set("sort", f.sort); + if (f.sort === "shuffle" && f.seed) p.set("seed", String(f.seed)); p.set("show_normal", String(f.includeNormal)); p.set("include_shorts", String(f.includeShorts)); p.set("include_live", String(f.includeLive));