import { Card, Group, Loader, SimpleGrid, Stack, Text, ThemeIcon } from '@mantine/core'; import { DoorOpen } from 'lucide-react'; import { Bar, BarChart, CartesianGrid, ResponsiveContainer, Tooltip, XAxis, YAxis, } from 'recharts'; import { useWarehouseGateStats } from '@/hooks/useWarehouses'; /** * Gate / dock throughput: items cleared through the gate today, the average * arrival→gate-clearance turnaround, and clearances per hour over the last 24h. */ export function GateThroughputCard() { const { data, isLoading } = useWarehouseGateStats(); const byHour = data?.byHour ?? []; const hasActivity = byHour.some((h) => h.count > 0); return (
Gate & dock throughput Gate clearances over the last 24 hours
{isLoading ? ( ) : ( Cleared today {data?.clearedToday ?? 0} through the gate Avg turnaround {data?.avgTurnaroundHours == null ? '—' : `${data.avgTurnaroundHours} h`} arrival → gate (30d) {hasActivity ? ( ) : ( No gate clearances in the last 24 hours. )} )}
); }