feat(feed): filter by year — per-year count facet + year control (E8·S2)
Add a Year filter to the feed rail: quick chips for recent years plus a 'More…' popover listing all years with per-year video counts, sortable by year or count. Selecting a year narrows the feed to that whole calendar year (a published_after/before range applied in the api layer) and is mutually exclusive with the Upload-date control. Backend: new /api/feed/years endpoint + feed_years() — one grouped query that honours every filter EXCEPT the publish-date narrowing (dropped), so the year list stays a live drill-down and switching years never zeroes the others. FE keys the list on the date-stripped filters, so picking a year re-queries the feed but not the list. Wires year through FeedFilters, the filterParams/URL (?year) round-trip, the active-filter chip row, and the panel layout. i18n HU+EN. Tests: feed_years count query (date narrowing ignored, other filters honoured); dateFilter year-clearing; urlState year round-trip.
This commit is contained in:
@@ -25,6 +25,7 @@ const KEYS = [
|
||||
"maxage",
|
||||
"from",
|
||||
"to",
|
||||
"year",
|
||||
"mindur",
|
||||
"maxdur",
|
||||
] as const;
|
||||
@@ -50,6 +51,7 @@ export function filtersToParams(f: FeedFilters): URLSearchParams {
|
||||
if (f.maxAgeDays) p.set("maxage", String(f.maxAgeDays));
|
||||
if (f.dateFrom) p.set("from", f.dateFrom);
|
||||
if (f.dateTo) p.set("to", f.dateTo);
|
||||
if (f.year) p.set("year", String(f.year));
|
||||
if (f.minDuration != null) p.set("mindur", String(f.minDuration));
|
||||
if (f.maxDuration != null) p.set("maxdur", String(f.maxDuration));
|
||||
return p;
|
||||
@@ -102,6 +104,7 @@ export function paramsToFilters(params: URLSearchParams, base: FeedFilters): Fee
|
||||
f.maxAgeDays = num(params.get("maxage"));
|
||||
f.dateFrom = params.get("from") || undefined;
|
||||
f.dateTo = params.get("to") || undefined;
|
||||
f.year = num(params.get("year"));
|
||||
f.minDuration = num(params.get("mindur"));
|
||||
f.maxDuration = num(params.get("maxdur"));
|
||||
return f;
|
||||
|
||||
Reference in New Issue
Block a user