improvement(filters): count Source + Library scope as active; unify Clear all; add search clear (X)
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).
This commit is contained in:
parent
53e4cd9aa3
commit
dc31d12fb0
5 changed files with 31 additions and 5 deletions
|
|
@ -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 && (
|
||||
<button
|
||||
onClick={() => setFilters({ ...filters, q: "" })}
|
||||
title={t("header.clearSearch")}
|
||||
aria-label={t("header.clearSearch")}
|
||||
className="absolute right-2.5 top-1/2 -translate-y-1/2 p-0.5 rounded-full text-muted hover:text-fg hover:bg-border/60 transition"
|
||||
>
|
||||
<X className="w-4 h-4" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{trimmedQ && canSearchYt && (
|
||||
<button
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue