import { Car, Footprints, Hotel, Zap } from 'lucide-react' import type { RouteSegment } from '../../types' // Walking gets the foot icon; a plugin route profile ('plugin:…') gets the bolt — // its legs carry the profile-true durationText anyway, the icon just signals that // the time came from a plugin router (e.g. EV routing with charge time folded in). function profileIcon(profile: string) { if (profile === 'walking') return Footprints if (profile.startsWith('plugin:')) return Zap return Car } /** Slim travel-time connector shown between two consecutive located stops in a day. */ export function RouteConnector({ seg, profile }: { seg: RouteSegment; profile: string }) { // The leg's own mode (#1281) wins over the day-wide fallback for icon + text. const effProfile = seg.mode ?? profile const driving = effProfile !== 'walking' const Icon = profileIcon(effProfile) const line = { flex: 1, height: 1, minHeight: 1, alignSelf: 'center', background: 'var(--border-primary)' } return (
{seg.durationText ?? (driving ? seg.drivingText : seg.walkingText)} · {seg.distanceText} {seg.noteText && ( <> · {seg.noteText} )}
) } /** * The hotel's bookend legs for a day: a two-line connector naming the day's * accommodation with the drive to/from it. Rendered above the first place (the * morning departure from the hotel) and below the last place (the evening return), * when the "optimize from accommodation" setting is on and the day has a hotel. */ export function HotelRouteConnector({ seg, profile, name, placement, }: { seg: RouteSegment profile: string name: string placement: 'top' | 'bottom' }) { const effProfile = seg.mode ?? profile const driving = effProfile !== 'walking' const Icon = profileIcon(effProfile) const line = { flex: 1, height: 1, minHeight: 1, alignSelf: 'center', background: 'var(--border-primary)' } const hotelRow = (
{name}
) const travelRow = (
{seg.durationText ?? (driving ? seg.drivingText : seg.walkingText)} · {seg.distanceText} {seg.noteText && ( <> · {seg.noteText} )}
) return (
{placement === 'top' ? ( <> {hotelRow} {travelRow} ) : ( <> {travelRow} {hotelRow} )}
) }