import { ExternalLink, MoveHorizontal, Route, X } from 'lucide-react'; import type { Ferrata } from '@trek/shared'; import { useTranslation } from '../../i18n'; import { useSettingsStore } from '../../store/settingsStore'; import { formatDistance } from '../../utils/units'; import { SoftPill } from '../Planner/planParts'; import { type FerrataGroup, ferrataLabel } from './ferrataGroups'; import { ferrataOsmUrl } from './ferrataModel'; /** * One via ferrata, picked on the map: its name, the route it belongs to, its * grade range and total length as badges, and the way back to the source. * `segment` is the OSM way that was clicked, which the source link opens. * OpenStreetMap's data is ODbL, which asks for the attribution next to * anything shown from it, so the card carries it rather than relying on the * map's own corner. */ export default function FerrataDetailCard({ group, segment, onClose, }: { group: FerrataGroup; segment: Ferrata; onClose?: () => void; }) { const { t } = useTranslation(); const unit = useSettingsStore((s) => s.settings.distance_unit); const label = ferrataLabel(group, t); const name = label.name; // The route line only adds something when it is not already the title. const route = group.routeName && group.routeName !== name ? group.routeName : null; // Without any grade the badge says so, rather than leaving a gap. const grade = label.grade ?? t('ferratas.unknownGrade'); return (
{grade} {group.lengthM > 0 && ( )}
{t('ferratas.viewInOsm')}

{t('ferratas.attribution')}

); }