From 7a129dc7638f53f9d9d3c4d9e49fb5e70159d264 Mon Sep 17 00:00:00 2001 From: bchanot Date: Mon, 16 Nov 2026 20:39:01 +0100 Subject: [PATCH] fix(app): filters toggle layout, constant spacing, one active-count helper --- apps/app/src/admin/filters.ts | 5 +++++ .../app/routes/app/admin/AdminSheetsRoute.tsx | 19 +++++++++++-------- apps/app/tests/unit/admin.sheetList.test.ts | 9 +++++++++ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/apps/app/src/admin/filters.ts b/apps/app/src/admin/filters.ts index 4a411b14..67457328 100644 --- a/apps/app/src/admin/filters.ts +++ b/apps/app/src/admin/filters.ts @@ -44,3 +44,8 @@ export function filterSheets( sheet.latest_round?.status === filters.roundStatus), ) } + +/** How many of the four filters are not empty. */ +export function activeFilterCount(filters: SheetFilters): number { + return Object.values(filters).filter(Boolean).length +} diff --git a/apps/app/src/app/routes/app/admin/AdminSheetsRoute.tsx b/apps/app/src/app/routes/app/admin/AdminSheetsRoute.tsx index 60833b87..47db0e1e 100644 --- a/apps/app/src/app/routes/app/admin/AdminSheetsRoute.tsx +++ b/apps/app/src/app/routes/app/admin/AdminSheetsRoute.tsx @@ -29,6 +29,7 @@ import { ROUND_STATUSES, SHEET_STATUSES, VERSION_STATUSES, + activeFilterCount, filterSheets, type SheetFilters, } from '@/admin/filters' @@ -307,7 +308,7 @@ const FILTERS_PANEL_ID = 'admin-sheets-filters' /** Phone only: « Filtres » or « Filtres (n) », n the filters that are not empty. */ function FiltersToggle({ view }: { view: ListView }) { const t = useT() - const active = Object.values(view.filters).filter(Boolean).length + const active = activeFilterCount(view.filters) return (