import React from 'react' import { MapPin } from 'lucide-react' import { useTranslation } from '../../i18n/TranslationContext' import { Tooltip } from '../shared/Tooltip' import AnchoredPopover from './AnchoredPopover' import { STOP_KINDS } from './stopKinds' import type { RoadtripStopType } from '@trek/shared' /** * Turning a place on the drive into a pause, and back. * * Opened from the stop's own number, because the number is exactly what changes: a * service stop has none. That makes the control its own preview — click the 3, pick the * pump, and the 3 becomes an orange disc while everything below renumbers itself. * * The kinds are the discs the rail already draws rather than a list of words. At this * size the colour and the shape are the label: a traveller who has seen one petrol stop * on the map knows the orange pump before reading anything, and six rows of text for six * icons would be a menu where a palette does. * * Only for stops on a drive. A place with no coordinates never reaches the rail, and a * hotel is not offered here at all, because sleeping somewhere is not a pause in the * driving — that path goes through the accommodation it books. */ const DISC = 'grid place-items-center rounded-full transition-transform' export default function StopKindPicker({ anchor, current, onPick, onClose }: { /** The element the popover hangs under, usually the stop's number. */ anchor: HTMLElement | null current: string | null onPick: (kind: RoadtripStopType | null) => void onClose: () => void }): React.ReactElement | null { const { t } = useTranslation() return (
{STOP_KINDS.map(({ key, labelKey, Icon, color }) => { const on = current === key return ( ) })}
{/* Only once there is something to undo. On an ordinary place it would be a button that says "leave everything as it is". */} {current ? ( ) : null}
) }