Implement admin database stats dashboard

Add admin-only database statistics dashboard
- Introduces types for database statistics and recent additions
- Implements hooks to fetch statistics and recent additions via RPCs
- Adds UI components for stats cards and a recent additions table
- Integrates new AdminDatabaseStats page and routing under /admin/database-stats
- Updates admin sidebar and app routes to expose the new dashboard
- Enables real-time updates and export capabilities for recent additions
This commit is contained in:
gpt-engineer-app[bot]
2025-11-11 16:54:02 +00:00
parent 69db3c7743
commit f036776dce
11 changed files with 906 additions and 1 deletions

View File

@@ -0,0 +1,62 @@
export interface DatabaseStatistics {
parks: {
total: number;
active: number;
historical: number;
added_7d: number;
added_30d: number;
};
rides: {
total: number;
active: number;
historical: number;
added_7d: number;
added_30d: number;
};
companies: {
total: number;
manufacturers: number;
operators: number;
designers: number;
added_7d: number;
added_30d: number;
};
ride_models: {
total: number;
added_7d: number;
added_30d: number;
};
locations: {
total: number;
};
timeline_events: {
total: number;
};
photos: {
total: number;
added_7d: number;
added_30d: number;
};
users: {
total: number;
active_30d: number;
};
submissions: {
pending: number;
approved: number;
rejected: number;
};
}
export interface RecentAddition {
entity_id: string;
entity_type: 'park' | 'ride' | 'company' | 'ride_model' | 'location' | 'timeline_event' | 'photo';
entity_name: string;
entity_slug: string | null;
park_slug: string | null;
image_url: string | null;
created_at: string;
created_by_id: string | null;
created_by_username: string | null;
created_by_avatar: string | null;
}