From dc31d12fb0e62ce7b996dc219251283ebfe4df0c Mon Sep 17 00:00:00 2001 From: npeter83 Date: Wed, 1 Jul 2026 04:22:39 +0200 Subject: [PATCH] improvement(filters): count Source + Library scope as active; unify Clear all; add search clear (X) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "Filters N active" badge and Clear all only tracked the sidebar facets (tags/show/sort/content/date/channel), so the toolbar-level Source and the Mine/Library scope neither bumped the count nor reset — inconsistent with filtersToParams (which treats them as filters, so Save view/Share already captured them). - activeCount now includes Library scope and a non-default Source; "relevance" (auto-applied while searching, no manual option) is excluded from the sort count so typing a query no longer inflates the badge. - Clear all resets scope back to "my" (Mine) and drops Source to organic, alongside the facets. The search q is intentionally preserved. - The header search box gets a clear (X) button when it holds a value, so the search has its own reset (clearing it reverts the relevance sort to newest). --- frontend/src/components/Header.tsx | 14 ++++++++++++-- frontend/src/components/Sidebar.tsx | 19 ++++++++++++++++--- frontend/src/i18n/locales/de/header.json | 1 + frontend/src/i18n/locales/en/header.json | 1 + frontend/src/i18n/locales/hu/header.json | 1 + 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/Header.tsx b/frontend/src/components/Header.tsx index 5291e92..9938a48 100644 --- a/frontend/src/components/Header.tsx +++ b/frontend/src/components/Header.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Library, Search, User, Youtube } from "lucide-react"; +import { Library, Search, User, X, Youtube } from "lucide-react"; import type { FeedFilters, Me } from "../lib/api"; import type { Page } from "../lib/urlState"; import SyncStatus from "./SyncStatus"; @@ -81,8 +81,18 @@ export default function Header({ if (e.key === "Enter" && trimmedQ && canSearchYt) onYtSearch(trimmedQ); }} placeholder={t("header.searchPlaceholder")} - className="w-full bg-card border border-border rounded-full pl-9 pr-4 py-2 text-sm outline-none focus:border-accent" + className="w-full bg-card border border-border rounded-full pl-9 pr-9 py-2 text-sm outline-none focus:border-accent" /> + {filters.q && ( + + )} {trimmedQ && canSearchYt && (