From 579af9cf893634d46f498605eee6c12b5cee791d Mon Sep 17 00:00:00 2001 From: npeter83 Date: Sat, 15 Aug 2026 00:35:22 +0200 Subject: [PATCH] refactor(ui): shared FilterChipGroup; unify feed filter chips (R13 S2c step 2) New single-select FilterChipGroup primitive on the canonical rounded-full "Filters bar" chip look (pill + shadow-xs + press feedback), plus an exported filterChipClass so multi-select siblings share ONE geometry source of truth. Migrations: - feed watch-state chips (F1, Feed.tsx) -> FilterChipGroup, testIds preserved - feed content-type toggles restyled to filterChipClass (stay multi-select) so the whole toolbar row is one chip look; wrapped in their own labelled group - feed date presets + Custom (F3, Sidebar.tsx) -> FilterChipGroup with a behaviour-preserving dispatch (preset toggle-off + Custom editor intact) Adds aria-label i18n (feed.showLabel/contentLabel, sidebar.datePresetLabel; HU+EN) and FilterChipGroup.dom.test.tsx (6 tests). Self-E2E'd: watch switch, date preset on/off toggle, Custom opens the range editor. gate green (vitest 136, tsc/eslint-0/knip/prettier). Branch not merged. --- frontend/src/components/Feed.tsx | 54 ++++++++------- .../components/FilterChipGroup.dom.test.tsx | 63 +++++++++++++++++ frontend/src/components/FilterChipGroup.tsx | 65 +++++++++++++++++ frontend/src/components/Sidebar.tsx | 69 ++++++++++--------- frontend/src/i18n/locales/en/feed.json | 2 + frontend/src/i18n/locales/en/sidebar.json | 1 + frontend/src/i18n/locales/hu/feed.json | 2 + frontend/src/i18n/locales/hu/sidebar.json | 1 + 8 files changed, 201 insertions(+), 56 deletions(-) create mode 100644 frontend/src/components/FilterChipGroup.dom.test.tsx create mode 100644 frontend/src/components/FilterChipGroup.tsx diff --git a/frontend/src/components/Feed.tsx b/frontend/src/components/Feed.tsx index e7d47c94..8440a519 100644 --- a/frontend/src/components/Feed.tsx +++ b/frontend/src/components/Feed.tsx @@ -40,6 +40,7 @@ import { LoadingState, StateMessage } from "./QueryState"; import { PageToolbar } from "./PageShell"; import { useWizard } from "./WizardProvider"; import SortControl from "./SortControl"; +import FilterChipGroup, { filterChipClass } from "./FilterChipGroup"; import ViewSwitcher from "./ViewSwitcher"; import VirtualFeed from "./VirtualFeed"; // Lazy: the in-app YouTube player (IFrame API) loads only when a video is first opened. @@ -563,32 +564,35 @@ export default function Feed({ const toolbar = (
- {SHOW_IDS.map((id) => ( - - ))} + ({ + value: id, + label: t("sidebar.show." + id), + testId: `feed-show-${id}`, + }))} + value={filters.show} + onChange={(show) => setFilters({ ...filters, show })} + />