Add BanTrendChart component and useBanTrend hook
- Add BanTrendBucket / BanTrendResponse interfaces to types/ban.ts - Add dashboardBansTrend endpoint constant to api/endpoints.ts - Add fetchBanTrend() to api/dashboard.ts - Create useBanTrend hook with abort-safe data fetching - Create BanTrendChart: AreaChart with gradient fill, dynamic X-axis labels per range, custom tooltip, loading/error/empty states - tsc --noEmit and ESLint pass with zero warnings
This commit is contained in:
@@ -289,7 +289,15 @@ class BanTrendResponse(BaseModel):
|
||||
|
||||
### Task 4.2 — Create the `BanTrendChart` component
|
||||
|
||||
**Status:** `not started`
|
||||
**Status:** `done`
|
||||
|
||||
Created `frontend/src/components/BanTrendChart.tsx` — an area chart using Recharts
|
||||
`AreaChart` with a gradient fill, human-readable X-axis time labels (format varies by
|
||||
time range), and a custom tooltip. Added `BanTrendBucket`/`BanTrendResponse` types to
|
||||
`types/ban.ts`, `dashboardBansTrend` constant to `api/endpoints.ts`, `fetchBanTrend()`
|
||||
to `api/dashboard.ts`, and the `useBanTrend` hook at `hooks/useBanTrend.ts`. Component
|
||||
handles loading (Spinner), error (MessageBar), and empty states inline.
|
||||
`tsc --noEmit` and ESLint pass with zero warnings.
|
||||
|
||||
Create `frontend/src/components/BanTrendChart.tsx`. This component renders an **area/line chart** showing the number of bans over time.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user