feat: Dashboard - Vehicle Fleet Overview (#2) #3
@@ -19,11 +19,13 @@ import { Vehicle } from '../../vehicles/types/vehicles.types';
|
|||||||
interface DashboardScreenProps {
|
interface DashboardScreenProps {
|
||||||
onNavigate?: (screen: MobileScreen, metadata?: Record<string, any>) => void;
|
onNavigate?: (screen: MobileScreen, metadata?: Record<string, any>) => void;
|
||||||
onVehicleClick?: (vehicle: Vehicle) => void;
|
onVehicleClick?: (vehicle: Vehicle) => void;
|
||||||
|
onViewMaintenance?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DashboardScreen: React.FC<DashboardScreenProps> = ({
|
export const DashboardScreen: React.FC<DashboardScreenProps> = ({
|
||||||
onNavigate,
|
onNavigate,
|
||||||
onVehicleClick
|
onVehicleClick,
|
||||||
|
onViewMaintenance
|
||||||
}) => {
|
}) => {
|
||||||
const { data: summary, isLoading: summaryLoading, error: summaryError } = useDashboardSummary();
|
const { data: summary, isLoading: summaryLoading, error: summaryError } = useDashboardSummary();
|
||||||
const { data: vehiclesNeedingAttention, isLoading: attentionLoading, error: attentionError } = useVehiclesNeedingAttention();
|
const { data: vehiclesNeedingAttention, isLoading: attentionLoading, error: attentionError } = useVehiclesNeedingAttention();
|
||||||
@@ -118,7 +120,7 @@ export const DashboardScreen: React.FC<DashboardScreenProps> = ({
|
|||||||
<QuickActions
|
<QuickActions
|
||||||
onAddVehicle={() => onNavigate?.('Vehicles')}
|
onAddVehicle={() => onNavigate?.('Vehicles')}
|
||||||
onLogFuel={() => onNavigate?.('Log Fuel')}
|
onLogFuel={() => onNavigate?.('Log Fuel')}
|
||||||
onViewMaintenance={() => onNavigate?.('Vehicles')} // Navigate to vehicles then maintenance
|
onViewMaintenance={onViewMaintenance ?? (() => onNavigate?.('Vehicles'))}
|
||||||
onViewVehicles={() => onNavigate?.('Vehicles')}
|
onViewVehicles={() => onNavigate?.('Vehicles')}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ export const DashboardPage: React.FC = () => {
|
|||||||
navigate(`/garage/vehicles/${vehicle.id}`);
|
navigate(`/garage/vehicles/${vehicle.id}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleViewMaintenance = () => {
|
||||||
|
navigate('/garage/maintenance');
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ py: 2 }}>
|
<Box sx={{ py: 2 }}>
|
||||||
<Typography variant="h4" sx={{ fontWeight: 700, color: 'text.primary', mb: 4 }}>
|
<Typography variant="h4" sx={{ fontWeight: 700, color: 'text.primary', mb: 4 }}>
|
||||||
@@ -47,6 +51,7 @@ export const DashboardPage: React.FC = () => {
|
|||||||
<DashboardScreen
|
<DashboardScreen
|
||||||
onNavigate={handleNavigate}
|
onNavigate={handleNavigate}
|
||||||
onVehicleClick={handleVehicleClick}
|
onVehicleClick={handleVehicleClick}
|
||||||
|
onViewMaintenance={handleViewMaintenance}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user