mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 03:26:07 +00:00
31859651d7
Every help screen checked against the v5 redesign. Tours is documented for the first time, as a screen of its own with twelve screens under it, and notifications get help of their own. All pictures are taken again on a realistic demo trip, with short loops where a still cannot show the motion. The English is plain and every language is written naturally rather than word for word. The switcher shows two levels at most, a screen's overview lists its sub-screens as cards above its guides, each wiki page is linked once, and the help sidebar is wider. Fixes found along the way: Save to Collection keeps a tour's route, a track dropped on the places column opens the Tours import, tour Share on desktop, the unsaved tour draft lives on the account, a route click no longer adds an end point, Trip places leaves the trip's tours out, Escape closes a stage's day menu, confirms before destructive deletes, DWD warnings sharing one id kept apart, a booking's date moves with it, and smaller fixes across notifications, bookings, the day plan, stays, Atlas, Collections, Vacay and the admin screens.
76 lines
3.1 KiB
TypeScript
76 lines
3.1 KiB
TypeScript
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. The share button beside it hands the same
|
|
* file to the system's share sheet where the platform takes GPX files, and a
|
|
* short text about the tour where it does not.
|
|
*/
|
|
export function TourGpxExportButton({ target }: { target: TourGpxExportTarget }) {
|
|
const { t } = useTranslation();
|
|
const { exportGpx, shareGpx, sharesFile, exporting } = useTourGpxExport(target);
|
|
const shareLabel = t(sharesFile ? 'tours.gpxExport.share' : 'tours.gpxExport.shareTour');
|
|
return (
|
|
<>
|
|
<Tooltip label={t('tours.gpxExport.hint')}>
|
|
<span className="inline-flex">
|
|
<DialogButton
|
|
onClick={() => void exportGpx(target)}
|
|
disabled={exporting}
|
|
aria-label={t('tours.gpxExport.action')}
|
|
data-testid="tour-gpx-export"
|
|
icon={exporting ? <Loader2 size={14} className="animate-spin" /> : <Download size={14} strokeWidth={2} />}
|
|
>
|
|
<span className="max-sm:hidden">GPX</span>
|
|
</DialogButton>
|
|
</span>
|
|
</Tooltip>
|
|
<Tooltip label={shareLabel}>
|
|
<span className="inline-flex">
|
|
<DialogButton
|
|
onClick={() => void shareGpx(target)}
|
|
disabled={exporting}
|
|
aria-label={shareLabel}
|
|
data-testid="tour-gpx-share"
|
|
icon={<Share size={14} strokeWidth={2} />}
|
|
>
|
|
<span className="max-sm:hidden">{t('tours.gpxExport.shareShort')}</span>
|
|
</DialogButton>
|
|
</span>
|
|
</Tooltip>
|
|
</>
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 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, sharesFile, exporting } = useTourGpxExport(unsaved ? null : target);
|
|
const shareLabel = sharesFile
|
|
? t(unsaved ? 'tours.gpxExport.shareSaveFirst' : 'tours.gpxExport.share')
|
|
: t(unsaved ? 'tours.gpxExport.shareTourSaveFirst' : 'tours.gpxExport.shareTour');
|
|
return (
|
|
<>
|
|
<BarButton
|
|
label={t(unsaved ? 'tours.gpxExport.saveFirst' : 'tours.gpxExport.action')}
|
|
onClick={() => void exportGpx(target)}
|
|
disabled={unsaved || exporting}
|
|
>
|
|
{exporting ? <Loader2 size={15} className="animate-spin" /> : <Download size={15} strokeWidth={2} />}
|
|
</BarButton>
|
|
<BarButton label={shareLabel} onClick={() => void shareGpx(target)} disabled={unsaved || exporting}>
|
|
<Share size={15} strokeWidth={2} />
|
|
</BarButton>
|
|
</>
|
|
);
|
|
}
|