import { AlertTriangle, CheckCircle2, CopyPlus, Loader2, Replace, Route, X } from 'lucide-react'; import type { ReactNode } from 'react'; import { useTranslation } from '../../../i18n'; import { useSettingsStore } from '../../../store/settingsStore'; import { formatDistance } from '../../../utils/units'; import { DialogButton, fs } from '../../shared/DialogShell'; import { useToast } from '../../shared/Toast'; import { Tooltip } from '../../shared/Tooltip'; import { CardAction, RailCard, RailFacts, type TourMetricField } from '../tourParts'; import { CORRIDOR_M, FAITHFUL_SHARE } from './gpxConversion'; import type { GpxConversion } from './useGpxConversion'; /** The two lines of the comparison as the map draws them: the import dotted, the suggestion solid. */ function LineLegend() { const { t } = useTranslation(); return (
{icon} {children}
); } /** * In the view of an import: plan an editable tour from it. Asked for, the * import's track turns into control points routed anew, and the card compares * that route to the track before anything is taken over. Taking it over either * plans the import over in place (its days and notes stay, the recorded track * is kept to go back to) or opens a new tour beside it. Both open in the editor * and are stored only when saved. */ export default function TourConversionSection({ conversion }: { conversion: GpxConversion }) { const { t } = useTranslation(); const toast = useToast(); const unit = useSettingsStore((state) => state.settings.distance_unit) ?? 'metric'; if (!conversion.available) return null; const adopt = (how: 'replace' | 'new') => { if (conversion.adopt(how)) toast.info(t(how === 'replace' ? 'tours.conversion.replacing' : 'tours.conversion.adopted')); }; const card = (children: ReactNode) => ({t( conversion.ski ? 'tours.conversion.introSki' : conversion.paddle ? 'tours.conversion.introPaddle' : 'tours.conversion.intro' )}