import { Box } from "@mui/material"; import { PageHeader } from "@/components/ui/page-header"; import { DashboardHeaderActions } from "@/app/(protected)/dashboard/_components/dashboard-header-actions"; import { DashboardKpiCards } from "@/app/(protected)/dashboard/_components/dashboard-kpi-cards"; import { DashboardTrendCard } from "@/app/(protected)/dashboard/_components/dashboard-trend-card"; import { DispatcherTablesSection } from "@/app/(protected)/dashboard/_components/dispatcher-tables-section"; import { StatusDistributionCard } from "@/app/(protected)/dashboard/_components/status-distribution-card"; import { useDashboardScope } from "@/app/(protected)/dashboard/_components/use-dashboard-scope"; import { VendorInsightsCard } from "@/app/(protected)/dashboard/_components/vendor-insights-card"; import { WorkOrderBreakdownCard } from "@/app/(protected)/dashboard/_components/work-order-breakdown-card"; import { WorkOrdersByRegionCard } from "@/app/(protected)/dashboard/_components/work-orders-by-region-card"; import { useDashboardPerformance } from "@/domain/dashboard/use-cases/use-dashboard-performance"; import { useDashboardRegions } from "@/domain/dashboard/use-cases/use-dashboard-regions"; import { useDashboardStats } from "@/domain/dashboard/use-cases/use-dashboard-stats"; import { useDashboardVendorInsights } from "@/domain/dashboard/use-cases/use-dashboard-vendor-insights"; import { useDashboardWorkload } from "@/domain/dashboard/use-cases/use-dashboard-workload"; import { useWorkOrderUsers } from "@/domain/work-orders/use-cases/use-work-orders-list"; export default function DashboardPage() { const scope = useDashboardScope(); const { canViewAll, range, dispatcherId, workloadPage, performancePage } = scope; const dispatcherUsers = useWorkOrderUsers(); const stats = useDashboardStats(range, dispatcherId); const workload = useDashboardWorkload(range, workloadPage, dispatcherId, canViewAll); const performance = useDashboardPerformance(range, performancePage, dispatcherId, canViewAll); const regions = useDashboardRegions(range, dispatcherId); const vendors = useDashboardVendorInsights(); const isRefreshing = [stats, workload, performance, regions, vendors].some((query) => query.isFetching) && !stats.isLoading; return ( } /> {canViewAll && ( )} ); }