From cef393473f8ed5de75ff3a94a109960dc7cea4be Mon Sep 17 00:00:00 2001 From: Mark Greene Date: Sun, 4 Oct 2026 14:39:30 +1300 Subject: [PATCH] Fix: testing and unlocked filters off by default and exclusive Both buttons in the testing and unlocked filter pairs started on, so showing only one kind meant turning the other kind off. Start all four filters off, treat a pair with neither button on as showing everything, and make the buttons in each pair mutually exclusive: turning one on turns its partner off, and clicking an active one turns it off. The playlist page now sets the unlocked filter on (and locked off) explicitly, since the old default no longer provides that. --- .../components/TankSearch/components/FilterControl.tsx | 4 ++++ packages/website/src/core/blitzkit/filterTank.ts | 6 ++++-- .../[...chunk_default]/[...locale]/playlist/_index.tsx | 5 ++++- packages/website/src/stores/tankFilters.ts | 8 ++++---- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/packages/website/src/components/TankSearch/components/FilterControl.tsx b/packages/website/src/components/TankSearch/components/FilterControl.tsx index ac7bde3b8..41400d365 100644 --- a/packages/website/src/components/TankSearch/components/FilterControl.tsx +++ b/packages/website/src/components/TankSearch/components/FilterControl.tsx @@ -789,6 +789,7 @@ function OwnershipFilterInternal(props: FlexProps) { onClick={() => { TankFilters.mutate((draft) => { draft.showOwned = !draft.showOwned; + if (draft.showOwned) draft.showUnowned = false; }); }} > @@ -808,6 +809,7 @@ function OwnershipFilterInternal(props: FlexProps) { onClick={() => { TankFilters.mutate((draft) => { draft.showUnowned = !draft.showUnowned; + if (draft.showUnowned) draft.showOwned = false; }); }} > @@ -834,6 +836,7 @@ function TestFilter() { onClick={() => { TankFilters.mutate((draft) => { draft.showNonTesting = !draft.showNonTesting; + if (draft.showNonTesting) draft.showTesting = false; }); }} > @@ -854,6 +857,7 @@ function TestFilter() { onClick={() => { TankFilters.mutate((draft) => { draft.showTesting = !draft.showTesting; + if (draft.showTesting) draft.showNonTesting = false; }); }} > diff --git a/packages/website/src/core/blitzkit/filterTank.ts b/packages/website/src/core/blitzkit/filterTank.ts index 91c808b56..48fc41a34 100644 --- a/packages/website/src/core/blitzkit/filterTank.ts +++ b/packages/website/src/core/blitzkit/filterTank.ts @@ -16,13 +16,15 @@ export async function filterTank( owned: number[] = [], ) { return ( - ((filters.showOwned && owned.includes(tank.id)) || + ((!filters.showOwned && !filters.showUnowned) || + (filters.showOwned && owned.includes(tank.id)) || (filters.showUnowned && !owned.includes(tank.id))) && (filters.tiers.length === 0 || filters.tiers.includes(tank.tier)) && (filters.nations.length === 0 || filters.nations.includes(tank.nation)) && (filters.classes.length === 0 || filters.classes.includes(tank.class)) && (filters.types.length === 0 || filters.types.includes(tank.type)) && - ((filters.showTesting && tank.testing) || + ((!filters.showTesting && !filters.showNonTesting) || + (filters.showTesting && tank.testing) || (filters.showNonTesting && !tank.testing)) && (filters.gunType.length === 0 || (filters.gunType.includes("regular") && diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/playlist/_index.tsx b/packages/website/src/pages/[...chunk_default]/[...locale]/playlist/_index.tsx index 04e090b26..9d6d906db 100644 --- a/packages/website/src/pages/[...chunk_default]/[...locale]/playlist/_index.tsx +++ b/packages/website/src/pages/[...chunk_default]/[...locale]/playlist/_index.tsx @@ -17,7 +17,10 @@ export function Page({ }: Props & MaybeSkeletonComponentProps) { const generated = Playlist.use((state) => state.list !== undefined); - if (App.state.logins.wargaming) TankFilters.state.showUnowned = false; + if (App.state.logins.wargaming) { + TankFilters.state.showOwned = true; + TankFilters.state.showUnowned = false; + } return ( diff --git a/packages/website/src/stores/tankFilters.ts b/packages/website/src/stores/tankFilters.ts index 7d1c1dcdb..438d327ae 100644 --- a/packages/website/src/stores/tankFilters.ts +++ b/packages/website/src/stores/tankFilters.ts @@ -46,8 +46,8 @@ export const TankFilters = new Varuna({ abilities: [], powers: [], - showTesting: true, - showNonTesting: true, - showOwned: true, - showUnowned: true, + showTesting: false, + showNonTesting: false, + showOwned: false, + showUnowned: false, });