Enhance admin stats dashboard

Add data quality metrics, growth trends visualization, entity comparison views, and automated health checks to the AdminDatabaseStats dashboard, including new TS types, hooks, UI components, and integrated tabbed layout.
This commit is contained in:
gpt-engineer-app[bot]
2025-11-11 17:11:11 +00:00
parent f036776dce
commit 947964482f
14 changed files with 1579 additions and 88 deletions

View File

@@ -0,0 +1,88 @@
/**
* Database Analytics Types
* For growth trends, entity comparisons, and health checks
*/
// Growth Trends
export interface GrowthTrendDataPoint {
period: string;
parks_added: number;
rides_added: number;
companies_added: number;
ride_models_added: number;
photos_added: number;
total_added: number;
}
export type GranularityType = 'daily' | 'weekly' | 'monthly';
// Entity Comparisons
export interface TopParkByRides {
park_name: string;
park_slug: string;
ride_count: number;
photo_count: number;
}
export interface TopManufacturer {
manufacturer_name: string;
slug: string;
ride_count: number;
model_count: number;
}
export interface TopOperator {
operator_name: string;
slug: string;
park_count: number;
ride_count: number;
}
export interface TopDesigner {
designer_name: string;
slug: string;
ride_count: number;
}
export interface TopParkByPhotos {
park_name: string;
park_slug: string;
photo_count: number;
}
export interface TopRideByPhotos {
ride_name: string;
ride_slug: string;
park_slug: string;
photo_count: number;
}
export interface EntityComparisons {
top_parks_by_rides: TopParkByRides[];
top_manufacturers: TopManufacturer[];
top_operators: TopOperator[];
top_designers: TopDesigner[];
top_parks_by_photos: TopParkByPhotos[];
top_rides_by_photos: TopRideByPhotos[];
}
// Database Health
export type HealthSeverity = 'critical' | 'warning' | 'info';
export interface HealthIssue {
severity: HealthSeverity;
category: string;
count: number;
entity_ids: string[];
description: string;
suggested_action: string;
}
export interface DatabaseHealthData {
overall_score: number;
critical_issues: number;
warning_issues: number;
info_issues: number;
issues: HealthIssue[];
checked_at: string;
}