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:
@@ -82,3 +82,31 @@ export interface DashboardBanListResponse {
|
||||
/** Maximum items per page. */
|
||||
page_size: number;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Ban trend
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* A single time bucket in the ban trend series.
|
||||
*
|
||||
* Mirrors `BanTrendBucket` from `backend/app/models/ban.py`.
|
||||
*/
|
||||
export interface BanTrendBucket {
|
||||
/** ISO 8601 UTC start of the bucket. */
|
||||
timestamp: string;
|
||||
/** Number of bans that started in this bucket. */
|
||||
count: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Response from `GET /api/dashboard/bans/trend`.
|
||||
*
|
||||
* Mirrors `BanTrendResponse` from `backend/app/models/ban.py`.
|
||||
*/
|
||||
export interface BanTrendResponse {
|
||||
/** Time-ordered list of ban-count buckets covering the full window. */
|
||||
buckets: BanTrendBucket[];
|
||||
/** Human-readable bucket size label, e.g. `"1h"`, `"6h"`, `"1d"`, `"7d"`. */
|
||||
bucket_size: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user