# BanGUI — Task List This document breaks the entire BanGUI project into development stages, ordered so that each stage builds on the previous one. Every task is described in prose with enough detail for a developer to begin work. References point to the relevant documentation. --- ## Stage 1 — Dashboard Charts Foundation ### Task 1.1 — Install and configure a charting library **Status:** `done` The frontend currently has no charting library. Install **Recharts** (`recharts`) as the project charting library. Recharts is React-native, composable, and integrates cleanly with Fluent UI v9 theming. **Steps:** 1. Run `npm install recharts` in the `frontend/` directory. 2. Verify the dependency appears in `package.json` under `dependencies`. 3. Confirm the build still succeeds with `npm run build` (no type errors, no warnings). No wrapper or configuration file is needed — Recharts components are imported directly where used. **Acceptance criteria:** - `recharts` is listed in `frontend/package.json`. - `npm run build` succeeds with zero errors or warnings. --- ### Task 1.2 — Create a shared chart theme utility **Status:** `done` Create a small utility at `frontend/src/utils/chartTheme.ts` that exports a function (or constant object) mapping Fluent UI v9 design tokens to Recharts-compatible colour values. The charts must respect the current Fluent theme (light and dark mode). At minimum export: - A palette of 5+ distinct categorical colours for pie/bar slices, derived from Fluent token aliases (e.g. `colorPaletteBlueBorderActive`, `colorPaletteRedBorderActive`, etc.). - Axis/grid/tooltip colours derived from `colorNeutralForeground2`, `colorNeutralStroke2`, `colorNeutralBackground1`, etc. - A helper that returns the CSS value of a Fluent token at runtime (since Recharts needs literal CSS colour strings, not CSS custom properties). Keep the file under 60 lines. No React components here — pure utility. **References:** [Web-Design.md](Web-Design.md) § colour tokens. **Acceptance criteria:** - The exported palette contains at least 5 distinct colours. - Colours change correctly between light and dark mode. - `tsc --noEmit` and `eslint` pass with zero warnings. --- ## Stage 2 — Country Pie Chart (Top 4 + Other) ### Task 2.1 — Create the `TopCountriesPieChart` component **Status:** `done` Create `frontend/src/components/TopCountriesPieChart.tsx`. This component renders a **pie chart (Kuchendiagramm)** showing the **top 4 countries by ban count** plus an **"Other"** slice that aggregates every remaining country. **Data source:** The component receives the `countries` map (`Record`) and `country_names` map (`Record`) from the existing `/api/dashboard/bans/by-country` endpoint response (`BansByCountryResponse`). No new API endpoint is needed. **Aggregation logic (frontend):** 1. Sort the `countries` entries descending by ban count. 2. Take the top 4 entries. 3. Sum all remaining entries into a single `"Other"` bucket. 4. The result is exactly 5 slices (or fewer if fewer than 5 countries exist). **Visual requirements:** - Use `` and `` from Recharts with `` for per-slice colours from the chart theme palette (Task 1.2). - Display a `` on hover showing the country name and ban count. - Display a `` listing each slice with its country name (full name from `country_names`, not just the code) and percentage. - Label each slice with the percentage (use Recharts `label` prop or `