Files
TREK/client/src/utils/pdfSwitch.ts
T
Maurice 12406bbbf4 feat(pdf): large text switch in the trip PDF preview (#2817)
A third switch next to the page break and transport notes switches scales the
day content's type by 1.35 and darkens its greys, for readers who print the
plan. Off by default and remembered per browser like the other two; the day
content's sizes and greys now come from three CSS variables on <body>.
2026-11-13 10:17:06 +01:00

23 lines
691 B
TypeScript

/*
* The switches of the trip PDF preview (a new page for every day, the notes of
* the transports, large text), remembered in this browser.
*/
/** A preview switch as it was last left; `defaultOn` until it is first touched, or when storage is blocked. */
export function pdfSwitchOn(key: string, defaultOn = true): boolean {
try {
const stored = localStorage.getItem(key);
return stored === null ? defaultOn : stored !== '0';
} catch {
return defaultOn;
}
}
export function rememberPdfSwitch(key: string, on: boolean): void {
try {
localStorage.setItem(key, on ? '1' : '0');
} catch {
// A blocked localStorage costs the preference, not the export.
}
}