Dispatch Pro
A live dispatch board, Onfleet-style. The fleet moves on the map, each van ringed in its health's colour and pointing where it's heading, with KPIs across the top. A fleet panel shows today's stops as a donut and what needs attention, worst first. The van and order lists have filters and search. Pick a van to see its driver, vehicle and stop timeline with ETAs, and late stops flagged. Assign a waiting order to the best van suggested, or hand a broken-down van's stops to another; each change has an undo. On desktops the panels float over the map. On phones you switch between Map (with a sheet), Vans and Orders.
Built from MapView, the Donut chart and free components.
import { DispatchScreen } from '@patine-ui/pro';
<DispatchScreen />;
<View style={{ width: '100%', height: 680 }}> <DispatchScreen /> </View>
Make it yours
| Prop | Type | Default |
|---|---|---|
initialFleet | Fleet: vans, orders, clock | The Seattle demo, 8 vans in 4 zones |
onCall | (van) => void | A notice, for the demo |
onMessage | (van) => void | |
title | string | 'Dispatch' |
subtitle | string | 'Seattle · 8 vans · 4 zones' |
The demo moves its fleet with useFleetSimulation. For live data, copy the screen and swap that hook for your feed: a websocket or subscription that replaces the fleet. The logic is pure and exported, so a server can share it: tickFleet, fleetStats, attention, stopStatuses, suggestVans, assignOrder and reassignStops.
The map opens on OpenStreetMap's tiles, which suit development. For production, pass a provider's URL with your key to MapView (see Tiles).
Built with
The free components, from patine-ui:
Avatar · Badge · Button · ChipGroup · Heading, Text · Progress · SearchField · SegmentedControl · Separator
And from Patine Pro:
- App shell and layout PRO
- Map PRO
- Patine Icons, the Pro set PRO
- Pie chart PRO
Files
dispatch/
├── components/
│ ├── AlertBanner.tsx
│ ├── DispatchTopBar.tsx
│ ├── FleetMap.tsx
│ ├── FleetPanel.tsx
│ ├── KpiStrip.tsx
│ ├── LiveIndicator.tsx
│ ├── Notice.tsx
│ ├── OrderQueue.tsx
│ ├── StopTimeline.tsx
│ ├── VanDetail.tsx
│ ├── VanList.tsx
│ ├── VanPin.tsx
│ └── VanRow.tsx
├── hooks/
│ ├── useDispatch.ts
│ └── useFleetSimulation.ts
├── dispatch.constants.ts
├── dispatch.data.ts
├── dispatch.types.ts
├── dispatch.utils.ts
├── DispatchScreen.tsx
└── index.ts
It also uses shared/, the theme, money formatting and screen transitions every Pro app shares.
A look at the code
Each van’s health, from dispatch.utils.ts:
/** A van's health from its numbers: stuck with stops or cargo too warm, stopped, a low battery, misses or late stops, or fine. */
export const healthOf = (van: Van, clock: number): VanHealth => {
if ((van.speed <= 0 && pending(van).length > 0) || (van.vehicle.refrigerated && (van.temp ?? 0) > SIM.maxTemp)) return 'alert';
if (van.speed <= 0) return 'watch';
if (van.battery < SIM.lowBattery || van.failed.length || stopStatuses(van, clock).some((s) => s.late && s.state !== 'done'))
return 'watch';
return 'ok';
};
Accessibility
- Every van, stop, waiting order and the depot is named on the map: "V-18, Maya Lindgren, on track".
- Van rows include health, the current stop and stops done; KPIs and the donut are read as words.
- The live indicator says when the fleet last updated, and pauses or resumes the updates.
- Health is in words as well as colour.