Add dashboard filter context to remove prop drilling

This commit is contained in:
2026-04-21 20:08:54 +02:00
parent b6d9c649ca
commit b7fbad0328
8 changed files with 164 additions and 39 deletions

View File

@@ -518,7 +518,11 @@ Update `JailConfig` (and the corresponding `JailConfigUpdate` patch type) to use
---
### TASK-026 — Props drilling: introduce a Dashboard filter context
### TASK-026 — Props drilling: introduce a Dashboard filter context (done)
**Where fixed:** `frontend/src/pages/DashboardPage.tsx`, `frontend/src/providers/DashboardFilterProvider.tsx`, `frontend/src/components/DashboardFilterBar.tsx`, `frontend/src/components/BanTrendChart.tsx`, `frontend/src/components/BanTable.tsx`, `frontend/src/components/JailDistributionChart.tsx`
**Summary:** Added `DashboardFilterProvider` and `useDashboardFilters` context. `DashboardPage` now wraps its content with the provider, and `DashboardFilterBar`, `BanTrendChart`, `BanTable`, and `JailDistributionChart` consume filter state from context while still supporting explicit prop overrides.
**Where found:** `frontend/src/pages/DashboardPage.tsx` passes `timeRange`, `originFilter`, and `source` individually as props to `BanTrendChart`, `BanTable`, `TopCountriesPieChart`, `TopCountriesBarChart`, and `JailDistributionChart`.