feat(feed): reshuffle button for the "surprise me" sort
The backend shuffle sort already accepts a seed param. Add a circular reshuffle button next to the sort control (shown only when shuffle is active) that re-rolls the seed and re-queries the feed; selecting shuffle also seeds a fresh order instead of the deterministic seed-0 one. The seed lives in FeedFilters but is intentionally kept out of the URL state.
This commit is contained in:
parent
ecea6b403c
commit
581faeaa34
5 changed files with 43 additions and 11 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue