mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 22:30:55 +00:00
feat: show only active vehicles on tracking map
Filter vehicles to status === 'ACTIVE': - Map markers: only active vehicles displayed - Vehicle dropdown: only active vehicles selectable - All vehicles list: renamed to "Active Vehicles (count)" - All use activeVehicles useMemo computed from vehiclesWithGPS Inactive vehicles (maintenance, idle, etc.) hidden from tracking view. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -54,12 +54,17 @@ export function TrackingPage() {
|
||||
}));
|
||||
}, [vehicles]);
|
||||
|
||||
const selectedVehicle = vehiclesWithGPS.find(v => v.id === selectedVehicleId);
|
||||
const vehicleOptions = useMemo(
|
||||
() => vehiclesWithGPS.map(v => ({ label: v.registrationNumber, value: v.id })),
|
||||
const activeVehicles = useMemo(
|
||||
() => vehiclesWithGPS.filter(v => v.status === 'ACTIVE'),
|
||||
[vehiclesWithGPS]
|
||||
);
|
||||
|
||||
const selectedVehicle = activeVehicles.find(v => v.id === selectedVehicleId);
|
||||
const vehicleOptions = useMemo(
|
||||
() => activeVehicles.map(v => ({ label: v.registrationNumber, value: v.id })),
|
||||
[activeVehicles]
|
||||
);
|
||||
|
||||
// Map dimensions
|
||||
const mapWidth = 800;
|
||||
const mapHeight = 500;
|
||||
@@ -146,8 +151,8 @@ export function TrackingPage() {
|
||||
))}
|
||||
</svg>
|
||||
|
||||
{/* Vehicle markers */}
|
||||
{vehiclesWithGPS.map((vehicle) => {
|
||||
{/* Vehicle markers - show only active vehicles */}
|
||||
{vehiclesWithGPS.filter(v => v.status === 'ACTIVE').map((vehicle) => {
|
||||
const coords = getMapCoords(vehicle.gps.lat, vehicle.gps.lng);
|
||||
const isSelected = vehicle.id === selectedVehicleId;
|
||||
|
||||
@@ -303,14 +308,14 @@ export function TrackingPage() {
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{/* All Vehicles List */}
|
||||
{/* All Active Vehicles List */}
|
||||
<Card withBorder p="lg">
|
||||
<Stack gap="md">
|
||||
<Text fw={500}>All Vehicles</Text>
|
||||
<Text fw={500}>Active Vehicles ({activeVehicles.length})</Text>
|
||||
<div style={{ maxHeight: '300px', overflowY: 'auto' }}>
|
||||
<Table size="sm">
|
||||
<Table.Tbody>
|
||||
{vehiclesWithGPS.slice(0, 10).map(v => (
|
||||
{activeVehicles.slice(0, 10).map(v => (
|
||||
<Table.Tr
|
||||
key={v.id}
|
||||
style={{
|
||||
|
||||
Reference in New Issue
Block a user