mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-13 15:51:00 +00:00
f8e51cb83d
An iPhone or iPad running TREK from the Home Screen ignores print(), in the page and in an iframe alike, so "Save as PDF" in the preview did nothing there. Mobile Safari prints the same preview fine. In the installed iOS app the preview now shows "Open in Safari" in place of the dead button, with a line saying why. The link opens the trip with ?export=pdf, and both shells open their export dialog or sheet for it, so the PDF is one tap away once Safari is up. The parameter is dropped once read and survives the login redirect. Everywhere else the preview prints as before. The preview overlay moves out of TripPDF.tsx into pdfPreview.ts, which TripPDF had no room left for under lint:size, and its backdrop and stacking now use the --overlay and --z-modal tokens.
15 lines
614 B
TypeScript
15 lines
614 B
TypeScript
/**
|
|
* An iPhone or iPad ignores print() in an app added to the Home Screen, in the
|
|
* page and in an iframe alike, so the trip PDF cannot be saved from there. Safari
|
|
* can print it. This is the link that hands the export over: it opens the trip in
|
|
* Safari with the export dialog already up.
|
|
*/
|
|
|
|
export const EXPORT_PARAM = 'export';
|
|
export const EXPORT_PDF = 'pdf';
|
|
|
|
/** The trip, opened with its export dialog showing. Absolute, since it leaves the installed app. */
|
|
export function pdfExportUrl(tripId: number): string {
|
|
return `${window.location.origin}/trips/${tripId}?${EXPORT_PARAM}=${EXPORT_PDF}`;
|
|
}
|