mirror of
https://github.com/SamyRai/turash.git
synced 2025-12-26 23:01:33 +00:00
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import { useDashboardStats } from '@/hooks/api/useAdminAPI.ts';
|
|
import { ActivityItem } from '@/components/admin/ActivityFeed';
|
|
|
|
export const useAdminDashboard = () => {
|
|
const { data: dashboardStats, isLoading, error } = useDashboardStats();
|
|
|
|
// Ensure stats always has valid numbers
|
|
const stats = {
|
|
total: dashboardStats?.totalOrganizations ?? 0,
|
|
verified: dashboardStats?.verifiedOrganizations ?? 0,
|
|
connections: dashboardStats?.activeConnections ?? 0,
|
|
newLast30Days: dashboardStats?.newThisMonth ?? 0,
|
|
};
|
|
|
|
// Real activity data - empty for now until backend endpoint is added
|
|
// TODO: Add useRecentActivity hook when backend endpoint is available
|
|
const recentActivity: ActivityItem[] = [];
|
|
|
|
// Quick actions data from API
|
|
const quickActions = {
|
|
pendingVerifications: dashboardStats?.pendingVerifications ?? 0,
|
|
pendingTranslations: dashboardStats?.pendingTranslations ?? 0,
|
|
systemAlerts: dashboardStats?.systemAlerts ?? 0,
|
|
};
|
|
|
|
return {
|
|
stats,
|
|
recentActivity,
|
|
quickActions,
|
|
isLoading,
|
|
error,
|
|
};
|
|
};
|