diff --git a/apps/web/src/components/sidebar/SidebarThreadFilterMenu.tsx b/apps/web/src/components/sidebar/SidebarThreadFilterMenu.tsx index 29691cb2208b1..701c9de907c69 100644 --- a/apps/web/src/components/sidebar/SidebarThreadFilterMenu.tsx +++ b/apps/web/src/components/sidebar/SidebarThreadFilterMenu.tsx @@ -32,6 +32,7 @@ import { import { SidebarHeaderIconButton } from "./SidebarThreadHeader"; import { changedThreadListFilters, + sidebarFilterIconClass, EMPTY_THREAD_LIST_FILTER_BUCKETS, inboxMenuOrder, type olderSettledFilterCounts, @@ -91,7 +92,7 @@ export function SidebarThreadFilterMenu({ return ( }> - 0 && "text-primary")} /> + 0)} /> { ).toBe(true); }); + it("tints a changed filter with an important primary color", () => { + // SidebarMenuButton's `[&>svg]:text-[var(--sidebar-icon-color)]` beats a + // plain text-primary on the icon, so the default class must not claim one. + expect(sidebarFilterIconClass(false)).toBe("size-4"); + expect(sidebarFilterIconClass(true)).toBe("size-4 text-primary!"); + }); + it("reports only sections that differ from this device's default", () => { const environments = [laptop, crown]; const unchanged = threadListFilterOf({ founderInboxOwner: "jeff" }); diff --git a/apps/web/src/components/sidebar/threadListFilter.logic.ts b/apps/web/src/components/sidebar/threadListFilter.logic.ts index dd2bc6b3fc368..9c4d4b1ba9c7b 100644 --- a/apps/web/src/components/sidebar/threadListFilter.logic.ts +++ b/apps/web/src/components/sidebar/threadListFilter.logic.ts @@ -200,6 +200,17 @@ export function toggleHiddenEnvironment( const sameMembers = (left: ReadonlyArray, right: ReadonlyArray) => left.length === right.length && left.every((value) => right.includes(value)); +/** + * Class for the filter sliders icon. + * + * `SidebarMenuButton` sets `[&>svg]:text-[var(--sidebar-icon-color)]` on the + * button, and that rule beats a plain `text-primary` on the icon, at rest and + * on hover. The important utility is what makes a non-default filter visible. + */ +export function sidebarFilterIconClass(changed: boolean): string { + return changed ? "size-4 text-primary!" : "size-4"; +} + /** Filter sections that differ from this device's default, ignoring removed environments. */ export function changedThreadListFilters( filter: ThreadListFilter,