mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-29 16:10:07 +00:00
fix(pdf): route every leg of the trip map and mark what is left unrouted
The PDF export routed the whole trip under an 8 s deadline while the router is asked one leg at a time, a second apart. A cold month-long trip got about seven legs routed per export; the rest printed as straight lines at "0 m" under a total that looked final, and every further export routed a few more days from the device cache. The export now waits for every leg, bounded by the request pacing, the rate-limit retries and a per-leg timeout. The export dialog and the phone sheet count the legs while they route and offer to print without the rest. Any leg left without a road is marked in the document: the day reads "not routed" or "at least ...", the total says it is a floor, and a note names how many legs are missing. The planner overview shares the same wording. The PDF also routes what the planner map routes now: the road trip's vias, the multi-day tour stages and the reader's distance unit. Closes #2876
This commit is contained in:
@@ -23,7 +23,7 @@ export default function MExportSheet({ planner, shell }: MTripSheetsProps) {
|
||||
// Fed the way the desktop dialog feeds it: the store's assignments, and the export
|
||||
// applies the day plan's filter itself, so both shells print the same. The PDF stays
|
||||
// open here; a calendar or GPX file closes the sheet.
|
||||
const { offerMine, isRunning, exportPdf, downloadIcs, downloadGpx } = useTripExport({
|
||||
const { offerMine, isRunning, exportPdf, pdfRouting, pdfRoutingLabel, skipPdfRouting, downloadIcs, downloadGpx } = useTripExport({
|
||||
tripId: planner.tripId,
|
||||
data: {
|
||||
trip: planner.trip,
|
||||
@@ -33,6 +33,8 @@ export default function MExportSheet({ planner, shell }: MTripSheetsProps) {
|
||||
categories: planner.categories,
|
||||
reservations: planner.reservations,
|
||||
dayNotes,
|
||||
viasByDay: planner.roadtripVias.byDay,
|
||||
tourStageStops: planner.tourStageStops,
|
||||
},
|
||||
t,
|
||||
locale,
|
||||
@@ -67,17 +69,26 @@ export default function MExportSheet({ planner, shell }: MTripSheetsProps) {
|
||||
<ExportRow
|
||||
icon={FileDown}
|
||||
title={isRunning('pdf') ? t('common.loading') : t('dayplan.pdf')}
|
||||
sub={t('dayplan.pdfTooltip')}
|
||||
sub={pdfRoutingLabel('pdf') ?? t('dayplan.pdfTooltip')}
|
||||
onClick={() => void exportPdf()}
|
||||
/>
|
||||
{offerMine && (
|
||||
<ExportRow
|
||||
icon={UserRound}
|
||||
title={isRunning('pdf:mine') ? t('common.loading') : t('dayplan.pdfMine')}
|
||||
sub={t('dayplan.pdfMineSub')}
|
||||
sub={pdfRoutingLabel('pdf:mine') ?? t('dayplan.pdfMineSub')}
|
||||
onClick={() => void exportPdf(true)}
|
||||
/>
|
||||
)}
|
||||
{pdfRouting && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={skipPdfRouting}
|
||||
className="self-end rounded-[10px] px-2 py-1 text-caption font-semibold text-m-muted"
|
||||
>
|
||||
{t('dayplan.pdfSkipRouting')}
|
||||
</button>
|
||||
)}
|
||||
<ExportRow
|
||||
icon={FileDown}
|
||||
title={isRunning('ics') ? t('common.loading') : t('mobileTrip.icsDownload')}
|
||||
|
||||
Reference in New Issue
Block a user