import { Download, Loader2, Share } from 'lucide-react'; import { useTranslation } from '../../i18n'; import { BarButton } from '../Planner/planParts'; import { DialogButton } from '../shared/DialogShell'; import { Tooltip } from '../shared/Tooltip'; import { useTourGpxExport, type TourGpxExportTarget } from './useTourGpxExport'; /** * PR1-06A, IO-01 in a footer: the saved tour as a GPX file, its own action * beside the navigation, which only leads to the start. "GPX" says the format, * the tooltip what the file holds. Where the platform takes GPX files, a share * button beside it hands the same file to the system's share sheet. */ export function TourGpxExportButton({ target }: { target: TourGpxExportTarget }) { const { t } = useTranslation(); const { exportGpx, shareGpx, canShare, exporting } = useTourGpxExport(); return ( <> void exportGpx(target)} disabled={exporting} aria-label={t('tours.gpxExport.action')} data-testid="tour-gpx-export" icon={exporting ? : } > GPX {canShare && ( void shareGpx(target)} disabled={exporting} aria-label={t('tours.gpxExport.share')} data-testid="tour-gpx-share" icon={} > {t('tours.gpxExport.shareShort')} )} ); } /** * The same export in the planner's head. While the tour has unsaved changes * the file would not hold them, so the buttons wait for the save and say so. */ export function TourGpxExportBarButton({ target, unsaved }: { target: TourGpxExportTarget; unsaved: boolean }) { const { t } = useTranslation(); const { exportGpx, shareGpx, canShare, exporting } = useTourGpxExport(); return ( <> void exportGpx(target)} disabled={unsaved || exporting} > {exporting ? : } {canShare && ( void shareGpx(target)} disabled={unsaved || exporting} > )} ); }