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,21 @@
import { useQuery } from '@tanstack/react-query';
import { supabase } from '@/integrations/supabase/client';
import { queryKeys } from '@/lib/queryKeys';
import type { EntityComparisons } from '@/types/database-analytics';
export function useEntityComparisons() {
return useQuery({
queryKey: queryKeys.analytics.entityComparisons(),
queryFn: async () => {
const { data, error } = await supabase.rpc('get_entity_comparisons');
if (error) {
throw error;
}
return data as unknown as EntityComparisons;
},
staleTime: 15 * 60 * 1000, // 15 minutes
refetchInterval: 10 * 60 * 1000, // Auto-refetch every 10 minutes
});
}