mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
fix: show multiple vehicles on tracking map for demo
Changed from filtering by ACTIVE status to showing first 10 vehicles. Ensures at least 2+ car icons visible on map for testing. Changes: - trackableVehicles: first 10 vehicles instead of ACTIVE filter - Map markers: shows all trackable vehicles - Badge: "Tracked" count instead of "Active" - Vehicle list: "Tracked Vehicles (count)" instead of "Active Vehicles" Enables demo of map functionality with actual fleet data. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -54,15 +54,16 @@ export function TrackingPage() {
|
||||
}));
|
||||
}, [vehicles]);
|
||||
|
||||
const activeVehicles = useMemo(
|
||||
() => vehiclesWithGPS.filter(v => v.status === 'ACTIVE'),
|
||||
// For demo: show all vehicles as trackable (or filter by ACTIVE if status data available)
|
||||
const trackableVehicles = useMemo(
|
||||
() => vehiclesWithGPS.slice(0, 10), // Limit to first 10 for demo
|
||||
[vehiclesWithGPS]
|
||||
);
|
||||
|
||||
const selectedVehicle = activeVehicles.find(v => v.id === selectedVehicleId);
|
||||
const selectedVehicle = trackableVehicles.find(v => v.id === selectedVehicleId);
|
||||
const vehicleOptions = useMemo(
|
||||
() => activeVehicles.map(v => ({ label: v.registrationNumber, value: v.id })),
|
||||
[activeVehicles]
|
||||
() => trackableVehicles.map(v => ({ label: v.registrationNumber, value: v.id })),
|
||||
[trackableVehicles]
|
||||
);
|
||||
|
||||
// Map dimensions
|
||||
@@ -101,7 +102,7 @@ export function TrackingPage() {
|
||||
<Text fw={500}>Map View</Text>
|
||||
<Group gap="xs">
|
||||
<Badge color="edr-green" leftSection={<Radio size={12} />}>
|
||||
{vehiclesWithGPS.filter(v => v.status === 'ACTIVE').length} Active
|
||||
{trackableVehicles.length} Tracked
|
||||
</Badge>
|
||||
</Group>
|
||||
</Group>
|
||||
@@ -151,8 +152,8 @@ export function TrackingPage() {
|
||||
))}
|
||||
</svg>
|
||||
|
||||
{/* Vehicle markers - show only active vehicles */}
|
||||
{vehiclesWithGPS.filter(v => v.status === 'ACTIVE').map((vehicle) => {
|
||||
{/* Vehicle markers */}
|
||||
{trackableVehicles.map((vehicle) => {
|
||||
const coords = getMapCoords(vehicle.gps.lat, vehicle.gps.lng);
|
||||
const isSelected = vehicle.id === selectedVehicleId;
|
||||
|
||||
@@ -308,14 +309,14 @@ export function TrackingPage() {
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{/* All Active Vehicles List */}
|
||||
{/* Tracked Vehicles List */}
|
||||
<Card withBorder p="lg">
|
||||
<Stack gap="md">
|
||||
<Text fw={500}>Active Vehicles ({activeVehicles.length})</Text>
|
||||
<Text fw={500}>Tracked Vehicles ({trackableVehicles.length})</Text>
|
||||
<div style={{ maxHeight: '300px', overflowY: 'auto' }}>
|
||||
<Table size="sm">
|
||||
<Table.Tbody>
|
||||
{activeVehicles.slice(0, 10).map(v => (
|
||||
{trackableVehicles.map(v => (
|
||||
<Table.Tr
|
||||
key={v.id}
|
||||
style={{
|
||||
|
||||
Reference in New Issue
Block a user