/** * @ai-summary Main dashboard screen component showing fleet overview */ import React from 'react'; import { Box } from '@mui/material'; import WarningAmberRoundedIcon from '@mui/icons-material/WarningAmberRounded'; import DirectionsCarRoundedIcon from '@mui/icons-material/DirectionsCarRounded'; import { SummaryCards, SummaryCardsSkeleton } from './SummaryCards'; import { VehicleAttention, VehicleAttentionSkeleton } from './VehicleAttention'; import { QuickActions, QuickActionsSkeleton } from './QuickActions'; import { useDashboardSummary, useVehiclesNeedingAttention } from '../hooks/useDashboardData'; import { GlassCard } from '../../../shared-minimal/components/mobile/GlassCard'; import { Button } from '../../../shared-minimal/components/Button'; import { MobileScreen } from '../../../core/store'; import { Vehicle } from '../../vehicles/types/vehicles.types'; interface DashboardScreenProps { onNavigate?: (screen: MobileScreen, metadata?: Record) => void; onVehicleClick?: (vehicle: Vehicle) => void; onViewMaintenance?: () => void; } export const DashboardScreen: React.FC = ({ onNavigate, onVehicleClick, onViewMaintenance }) => { const { data: summary, isLoading: summaryLoading, error: summaryError } = useDashboardSummary(); const { data: vehiclesNeedingAttention, isLoading: attentionLoading, error: attentionError } = useVehiclesNeedingAttention(); // Error state if (summaryError || attentionError) { return (

Unable to Load Dashboard

There was an error loading your dashboard data

); } // Loading state if (summaryLoading || attentionLoading || !summary || !vehiclesNeedingAttention) { return (
); } // Empty state - no vehicles if (summary.totalVehicles === 0) { return (

Welcome to MotoVaultPro

Get started by adding your first vehicle to track fuel logs, maintenance, and more

); } // Main dashboard view return (
{/* Summary Cards */} {/* Vehicles Needing Attention */} {vehiclesNeedingAttention && vehiclesNeedingAttention.length > 0 && ( { const vehicle = vehiclesNeedingAttention.find(v => v.id === vehicleId); if (vehicle && onVehicleClick) { onVehicleClick(vehicle); } }} /> )} {/* Quick Actions */} onNavigate?.('Vehicles')} onLogFuel={() => onNavigate?.('Log Fuel')} onViewMaintenance={onViewMaintenance ?? (() => onNavigate?.('Vehicles'))} onViewVehicles={() => onNavigate?.('Vehicles')} /> {/* Footer Hint */}

Dashboard updates every 2 minutes

); };