diff --git a/src/features/store-admin/GroupMap.tsx b/src/features/store-admin/GroupMap.tsx index e6e181a..c8de7df 100644 --- a/src/features/store-admin/GroupMap.tsx +++ b/src/features/store-admin/GroupMap.tsx @@ -1,5 +1,6 @@ import { useMemo } from 'react'; import { TrailMap, trailColour, type MapPin, type MapTrail } from '@/components/TrailMap'; +import type { TenantLocation } from '@/api/types'; import type { Stop } from './dispatchModel'; import { routingApi } from '@/api/routing'; import { mapStop, roundsOf, shopsOf, type Point } from './deliveryTrack'; diff --git a/src/features/store-admin/pages/DispatchPage.tsx b/src/features/store-admin/pages/DispatchPage.tsx index 505a513..33929d7 100644 --- a/src/features/store-admin/pages/DispatchPage.tsx +++ b/src/features/store-admin/pages/DispatchPage.tsx @@ -1,6 +1,5 @@ import { useMemo, useState, type ReactNode } from 'react'; import { Card } from '@astryxdesign/core/Card'; -import { HStack } from '@astryxdesign/core/HStack'; import { Text } from '@astryxdesign/core/Text'; import { VStack } from '@astryxdesign/core/VStack'; import { @@ -542,12 +541,12 @@ function getStableGroupColor(id: string, index: number, isUnassigned: boolean, m if (mode === 'stores') return '#f59e0b'; if (mode === 'customers') return '#8b5cf6'; const s = String(id ?? ''); - if (!s) return RIDER_COLORS[index % RIDER_COLORS.length]; + if (!s) return RIDER_COLORS[index % RIDER_COLORS.length]!; let h = 0; for (let i = 0; i < s.length; i++) { h = (h * 31 + s.charCodeAt(i)) >>> 0; } - return RIDER_COLORS[h % RIDER_COLORS.length]; + return RIDER_COLORS[h % RIDER_COLORS.length]!; } function EnhancedGroupList({ @@ -590,14 +589,13 @@ function EnhancedGroupList({ const isDone = total > 0 && done >= total; const color = getStableGroupColor(group.id, i, isUnassigned, mode); - // Subtitle / Trips / Zone + // Subtitle / Zone let zoneSubtitle = ''; if (mode === 'riders') { - const tripCount = new Set( - group.stops.map((s) => (s.kind === 'delivery' ? (s.row.trip_number || 1) : 1)) - ).size; - const loc = group.detail || 'Local'; - zoneSubtitle = `${loc} · ${tripCount} ${tripCount === 1 ? 'trip' : 'trips'}`; + // No trip number reaches the console — a delivery row carries no such + // field — so a "N trips" count here would always read 1. The rider's + // contact is the one real detail this group has. + zoneSubtitle = group.detail || 'No contact'; } else if (mode === 'stores') { zoneSubtitle = `${group.riders.size} ${group.riders.size === 1 ? 'rider' : 'riders'}`; } else {