Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(maps): narrow the PDF map container and assert the 3D toast by its key

Maurice45ae8b5af260
diff --git a/client/scripts/eslint-baseline.json b/client/scripts/eslint-baseline.json
index 5c1b4105f..abecc8977 100644
--- a/client/scripts/eslint-baseline.json
+++ b/client/scripts/eslint-baseline.json
@@ -10,7 +10,7 @@
"trek/store-without-selector": 67,
"react-hooks/refs": 555,
"react-hooks/set-state-in-effect": 194,
- "@typescript-eslint/no-floating-promises": 165,
+ "@typescript-eslint/no-floating-promises": 164,
"react-hooks/exhaustive-deps": 116,
"@typescript-eslint/no-unused-vars": 124,
"react-hooks/immutability": 28,
diff --git a/client/src/components/PDF/tripMapImage.ts b/client/src/components/PDF/tripMapImage.ts
index d82727ad0..39921bf5f 100644
--- a/client/src/components/PDF/tripMapImage.ts
+++ b/client/src/components/PDF/tripMapImage.ts
@@ -50,18 +50,20 @@ export async function renderTripMapImage(
try {
const gl = (await importChunk(() => import('../Map/engines/maplibre'))).default
- container = document.createElement('div')
+ // A const of its own: the map is built inside a closure, where the let's narrowing is gone.
+ const box = document.createElement('div')
+ container = box
// Off-screen rather than hidden: MapLibre needs a laid-out box with real
// dimensions, and `display:none` gives it a zero-sized canvas.
- container.style.cssText =
+ box.style.cssText =
`position:fixed;left:-10000px;top:0;width:${width}px;height:${height}px;pointer-events:none;`
- document.body.appendChild(container)
+ document.body.appendChild(box)
const bounds = new gl.LngLatBounds()
for (const [lat, lng] of points) bounds.extend([lng, lat])
const instance = buildGlMap(() => new gl.Map({
- container,
+ container: box,
style: normalizeStyleForProvider('maplibre-gl', opts.style),
bounds,
fitBoundsOptions: { padding: 42, animate: false },
diff --git a/client/src/pages/tripPlanner/TourPlannerMapStage.test.tsx b/client/src/pages/tripPlanner/TourPlannerMapStage.test.tsx
index 6cc0bf74f..9bd4e9345 100644
--- a/client/src/pages/tripPlanner/TourPlannerMapStage.test.tsx
+++ b/client/src/pages/tripPlanner/TourPlannerMapStage.test.tsx
@@ -940,7 +940,8 @@ describe('TourPlannerMapStage', () => {
});
describe('3D without WebGL2', () => {
- const NO_3D = '3D needs WebGL2, which this browser does not offer. The map stays in 2D.';
+ // The stage translates with the t it is handed, and stageProps hands it one that returns the key.
+ const NO_3D = 'map.webgl2.terrain';
function renderWithToasts(tourPlanner: Planner) {
return render(