This commit is contained in:
Matthias Hochmeister
2026-03-26 16:12:18 +01:00
parent 19dd528765
commit 03f489d546
5 changed files with 40 additions and 102 deletions

View File

@@ -6,10 +6,9 @@ import {
Card,
CardContent,
CircularProgress,
Link,
Typography,
} from '@mui/material';
import { Link as RouterLink } from 'react-router-dom';
import { useNavigate } from 'react-router-dom';
import { useQuery } from '@tanstack/react-query';
import { vehiclesApi } from '../../services/vehicles';
import { equipmentApi } from '../../services/equipment';
@@ -24,6 +23,7 @@ interface VehicleDashboardCardProps {
const VehicleDashboardCard: React.FC<VehicleDashboardCardProps> = ({
hideWhenEmpty = false,
}) => {
const navigate = useNavigate();
const { data: stats, isLoading: statsLoading, isError: statsError } = useQuery<VehicleStats>({
queryKey: ['vehicle-stats'],
queryFn: () => vehiclesApi.getStats(),
@@ -85,7 +85,7 @@ const VehicleDashboardCard: React.FC<VehicleDashboardCardProps> = ({
if (hideWhenEmpty && allGood) return null;
return (
<Card sx={{ height: '100%' }}>
<Card sx={{ height: '100%', cursor: 'pointer' }} onClick={() => navigate('/fahrzeuge')}>
<CardContent>
<Typography variant="h6" gutterBottom>
Fahrzeuge
@@ -143,18 +143,6 @@ const VehicleDashboardCard: React.FC<VehicleDashboardCardProps> = ({
Alle Fahrzeuge einsatzbereit
</Typography>
)}
{/* Link to management page */}
<Box sx={{ mt: 2 }}>
<Link
component={RouterLink}
to="/fahrzeuge"
underline="hover"
variant="body2"
>
Zur Verwaltung
</Link>
</Box>
</CardContent>
</Card>
);