import { useState, useMemo } from 'react' import { useQuery } from '@tanstack/react-query' import { Link } from '@tanstack/react-router' import { useAuth } from '@/lib/auth' import { metricsApi, tenantsApi, type FleetDevice } from '@/lib/api' import { useUIStore } from '@/lib/store' import { alertsApi } from '@/lib/alertsApi' import { useEventStreamContext } from '@/contexts/EventStreamContext' import { LayoutDashboard, MapPin } from 'lucide-react' import { cn } from '@/lib/utils' import { LoadingText } from '@/components/ui/skeleton' import { EmptyState } from '@/components/ui/empty-state' // ─── Dashboard Widgets ─────────────────────────────────────────────────────── import { HealthScore } from '@/components/dashboard/HealthScore' import { EventsTimeline } from '@/components/dashboard/EventsTimeline' import { BandwidthChart, type BandwidthDevice } from '@/components/dashboard/BandwidthChart' import { AlertSummary } from '@/components/dashboard/AlertSummary' import { QuickActions } from '@/components/dashboard/QuickActions' import { WirelessIssues } from '@/components/dashboard/WirelessIssues' // ─── Types ─────────────────────────────────────────────────────────────────── type RefreshInterval = 15000 | 30000 | 60000 | false const REFRESH_OPTIONS: { label: string; value: RefreshInterval }[] = [ { label: '15s', value: 15000 }, { label: '30s', value: 30000 }, { label: '60s', value: 60000 }, { label: 'Off', value: false }, ] // ─── Dashboard Loading ─────────────────────────────────────────────────────── function DashboardLoading() { return (
Fleet overview across{' '} {isSuperAdmin ? selectedTenantId && selectedTenantName ? selectedTenantName : 'all tenants' : 'your organization'}