From b73f749880544d904e30f58adece8054ae465166 Mon Sep 17 00:00:00 2001 From: Maurice Date: Sun, 8 Nov 2026 12:13:20 +0100 Subject: [PATCH] fix(mobile): no how-to line on the 3D map on a tablet --- .../components/Tours/terrain/TourTerrainMap.test.tsx | 12 ++++++++++++ .../src/components/Tours/terrain/TourTerrainMap.tsx | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/client/src/components/Tours/terrain/TourTerrainMap.test.tsx b/client/src/components/Tours/terrain/TourTerrainMap.test.tsx index 26352ad1e..086625aef 100644 --- a/client/src/components/Tours/terrain/TourTerrainMap.test.tsx +++ b/client/src/components/Tours/terrain/TourTerrainMap.test.tsx @@ -1,6 +1,7 @@ // FE-COMP-TERRAIN-001 to FE-COMP-TERRAIN-018 import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { act, fireEvent, render, screen, waitFor } from '../../../../tests/helpers/render'; +import { resetSizeClass, setSizeClass } from '../../../../tests/helpers/sizeClass'; import type { DistanceIndexedProfileSample, RouteProfileFocus } from '../../../utils/routeGeometry'; import TourTerrainMap, { type TourTerrainMapProps } from './TourTerrainMap'; @@ -257,6 +258,17 @@ describe('TourTerrainMap', () => { expect(screen.queryByRole('button', { name: 'Play flyover' })).toBeNull(); }); + it('FE-COMP-TERRAIN-002b: on an iPad or an unfolded foldable the how-to line stays out of the map', async () => { + setSizeClass('split'); + try { + await renderTerrain(); + expect(screen.queryByText('Open a tour on the right to fly it in 3D and colour it by grade.')).toBeNull(); + expect(screen.queryByText(/Click the terrain to set points/)).toBeNull(); + } finally { + resetSizeClass(); + } + }); + it('FE-COMP-TERRAIN-003: a click on the terrain adds a control point only while editing', async () => { const onAdd = vi.fn(); const { rerender } = await renderTerrain({ waypoints: { points: [], selectedId: null, onSelect: vi.fn(), onAdd } }); diff --git a/client/src/components/Tours/terrain/TourTerrainMap.tsx b/client/src/components/Tours/terrain/TourTerrainMap.tsx index 92c7f1f4a..64262f027 100644 --- a/client/src/components/Tours/terrain/TourTerrainMap.tsx +++ b/client/src/components/Tours/terrain/TourTerrainMap.tsx @@ -1,6 +1,7 @@ import type { FerrataBbox } from '@trek/shared'; import { ChevronDown, ChevronUp, Gauge, Palette, Pause, Play, RotateCcw, Scan, TrendingUp } from 'lucide-react'; import { useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type ReactNode } from 'react'; +import { useIsWide } from '../../../hooks/sizeClass'; import { useTranslation } from '../../../i18n'; import type { DistanceUnit } from '../../../types'; import type { DistanceIndexedProfileSample, RouteProfileFocus } from '../../../utils/routeGeometry'; @@ -84,6 +85,7 @@ export default function TourTerrainMap(props: TourTerrainMapProps) { const { setContainer, ...terrain } = useTourTerrain({ ...props, panels: { leftWidth, rightWidth } }); const stats = useMemo(() => terrainStats(samples), [samples]); const { fit, height: controlsHeight, attachRow, attachStack } = useControlRowFit(); + const touchShell = useIsWide(); const legend = terrain.canReplay && !props.water ? ( @@ -134,6 +136,9 @@ export default function TourTerrainMap(props: TourTerrainMapProps) { {terrain.canReplay ? ( + ) : touchShell ? ( + // A tablet's map is short on room, and its user learns the gestures by touch: no how-to line. + ) : (