2026-04-20 20:59:18 +00:00
|
|
|
import { Car, Footprints, Bike } from 'lucide-react'
|
feat: search, multi-stop routing, and route display
Full navigation UI with:
- Search bar with 150ms debounced autocomplete from /api/geocode
- Keyboard navigation (arrow keys, Enter, Escape)
- Exact match badge for verified address results
- Multi-stop list with drag-to-reorder (dnd-kit)
- 10-stop cap with disabled state
- Mode selector (drive/walk/bike)
- Valhalla route display with per-leg color polyline
- Maneuver list with instructions, distance, time remaining
- Click maneuver to fly map to that point
- Optimize stops button (3+ stops, uses /optimized_route)
- Responsive: side panel (desktop ≥768px), bottom sheet (mobile)
- Stop pins: green origin, red destination, blue intermediate
- Pin popup with remove button
- Geolocation permission requested on first route, not on load
- Error handling for unroutable pairs
- nginx proxy for /api/ and /valhalla/ endpoints
Dependencies added: zustand, @dnd-kit/core, @dnd-kit/sortable,
@dnd-kit/utilities
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-20 16:50:53 +00:00
|
|
|
import { useStore } from '../store'
|
|
|
|
|
|
|
|
|
|
const MODES = [
|
2026-04-20 20:59:18 +00:00
|
|
|
{ id: 'auto', label: 'Drive', Icon: Car },
|
|
|
|
|
{ id: 'pedestrian', label: 'Walk', Icon: Footprints },
|
|
|
|
|
{ id: 'bicycle', label: 'Bike', Icon: Bike },
|
feat: search, multi-stop routing, and route display
Full navigation UI with:
- Search bar with 150ms debounced autocomplete from /api/geocode
- Keyboard navigation (arrow keys, Enter, Escape)
- Exact match badge for verified address results
- Multi-stop list with drag-to-reorder (dnd-kit)
- 10-stop cap with disabled state
- Mode selector (drive/walk/bike)
- Valhalla route display with per-leg color polyline
- Maneuver list with instructions, distance, time remaining
- Click maneuver to fly map to that point
- Optimize stops button (3+ stops, uses /optimized_route)
- Responsive: side panel (desktop ≥768px), bottom sheet (mobile)
- Stop pins: green origin, red destination, blue intermediate
- Pin popup with remove button
- Geolocation permission requested on first route, not on load
- Error handling for unroutable pairs
- nginx proxy for /api/ and /valhalla/ endpoints
Dependencies added: zustand, @dnd-kit/core, @dnd-kit/sortable,
@dnd-kit/utilities
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-20 16:50:53 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
export default function ModeSelector() {
|
|
|
|
|
const mode = useStore((s) => s.mode)
|
|
|
|
|
const setMode = useStore((s) => s.setMode)
|
|
|
|
|
|
|
|
|
|
return (
|
2026-04-20 20:59:18 +00:00
|
|
|
<div
|
|
|
|
|
className="flex rounded-lg overflow-hidden"
|
|
|
|
|
style={{ border: '1px solid var(--border)' }}
|
|
|
|
|
role="radiogroup"
|
|
|
|
|
aria-label="Travel mode"
|
|
|
|
|
>
|
|
|
|
|
{MODES.map((m) => {
|
|
|
|
|
const active = mode === m.id
|
|
|
|
|
return (
|
|
|
|
|
<button
|
|
|
|
|
key={m.id}
|
|
|
|
|
role="radio"
|
|
|
|
|
aria-checked={active}
|
|
|
|
|
onClick={() => setMode(m.id)}
|
2026-04-22 03:27:21 +00:00
|
|
|
className="flex-1 min-w-0 flex items-center justify-center gap-1.5 py-2 px-2 text-xs font-medium transition-colors duration-100"
|
2026-04-20 20:59:18 +00:00
|
|
|
style={{
|
|
|
|
|
background: active ? 'var(--accent-muted)' : 'transparent',
|
|
|
|
|
color: active ? 'var(--accent)' : 'var(--text-secondary)',
|
|
|
|
|
borderRight: m.id !== 'bicycle' ? '1px solid var(--border)' : 'none',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<m.Icon size={14} />
|
|
|
|
|
{m.label}
|
|
|
|
|
</button>
|
|
|
|
|
)
|
|
|
|
|
})}
|
feat: search, multi-stop routing, and route display
Full navigation UI with:
- Search bar with 150ms debounced autocomplete from /api/geocode
- Keyboard navigation (arrow keys, Enter, Escape)
- Exact match badge for verified address results
- Multi-stop list with drag-to-reorder (dnd-kit)
- 10-stop cap with disabled state
- Mode selector (drive/walk/bike)
- Valhalla route display with per-leg color polyline
- Maneuver list with instructions, distance, time remaining
- Click maneuver to fly map to that point
- Optimize stops button (3+ stops, uses /optimized_route)
- Responsive: side panel (desktop ≥768px), bottom sheet (mobile)
- Stop pins: green origin, red destination, blue intermediate
- Pin popup with remove button
- Geolocation permission requested on first route, not on load
- Error handling for unroutable pairs
- nginx proxy for /api/ and /valhalla/ endpoints
Dependencies added: zustand, @dnd-kit/core, @dnd-kit/sortable,
@dnd-kit/utilities
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-20 16:50:53 +00:00
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|