fix: the map falls back to raster where the vector style cannot load, the tour layer pill fits narrow maps and stands on the side in 3D, the dashboard's widget column scrolls on its own, and the CI checks the watch sync and journey write-up broke

This commit is contained in:
Maurice
2026-11-08 12:05:59 +01:00
parent cb41f08199
commit c7f144d3ff
21 changed files with 334 additions and 44 deletions
@@ -88,7 +88,20 @@ export default function TourTerrainMap(props: TourTerrainMapProps) {
terrain.canReplay && !props.water ? (
<GradeLegend stats={stats} unit={unit} onLayout={props.onLegendLayout} />
) : null;
const legendAbove = fit === 'stacked';
const legendAbove = fit === 'stacked' || fit === 'side';
const layerSwitcher = (vertical: boolean) => (
<TourMapLayerSwitcher
active={baseLayer}
onChange={onBaseLayerChange}
terrainActive
onToggleTerrain={onExit}
ferrataLayer={props.ferrataLayer}
placeTool={props.placeTool}
layers={props.tourLayers}
compact={fit !== 'full'}
vertical={vertical}
/>
);
useEffect(() => {
if (controlsHeight !== null) onControlsHeightChange?.(controlsHeight);
@@ -112,21 +125,11 @@ export default function TourTerrainMap(props: TourTerrainMapProps) {
insetInlineEnd: rightWidth + MAP_LAYER_SWITCHER_INSET,
}}
>
{fit === 'side' && layerSwitcher(true)}
<BaseMapCredit layer={baseLayer} />
{legendAbove && legend}
<div ref={attachRow} className="flex w-full items-end gap-3" data-fit={fit} data-testid="terrain-control-row">
<div className="flex-none">
<TourMapLayerSwitcher
active={baseLayer}
onChange={onBaseLayerChange}
terrainActive
onToggleTerrain={onExit}
ferrataLayer={props.ferrataLayer}
placeTool={props.placeTool}
layers={props.tourLayers}
compact={fit !== 'full'}
/>
</div>
{fit !== 'side' && <div className="flex-none">{layerSwitcher(false)}</div>}
<div className="grid min-w-0 flex-1 grid-cols-[1fr_auto_1fr] items-end gap-3">
<span />
{terrain.canReplay ? (
@@ -1,11 +1,11 @@
// FE-TERRAIN-FIT-001 to FE-TERRAIN-FIT-002: the 3D map's bottom row steps down to fit between the panels.
// FE-TERRAIN-FIT-001 to FE-TERRAIN-FIT-003: the 3D map's bottom row steps down to fit between the panels.
import { act, renderHook } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { type ControlRowFit, useControlRowFit } from './useControlRowFit';
/** What the row's content needs at each step, in pixels. */
const NEEDS: Record<ControlRowFit, number> = { full: 700, compact: 480, stacked: 400 };
const NEEDS: Record<ControlRowFit, number> = { full: 700, compact: 480, stacked: 400, side: 260 };
function fakeRow(room: { width: number }, fit: () => ControlRowFit): HTMLDivElement {
const row = document.createElement('div');
@@ -49,4 +49,21 @@ describe('useControlRowFit', () => {
rerender();
expect(result.current.fit).toBe('full');
});
it('FE-TERRAIN-FIT-003: where even the stacked row overflows, the layer pill goes to the side, and comes back with the room', () => {
const room = { width: 300 };
const { result, rerender } = renderHook(() => useControlRowFit());
const row = fakeRow(room, () => result.current.fit);
act(() => result.current.attachRow(row));
rerender();
rerender();
expect(result.current.fit).toBe('side');
room.width = 399;
rerender();
expect(result.current.fit).toBe('side');
room.width = 400;
rerender();
expect(result.current.fit).toBe('stacked');
});
});
@@ -2,12 +2,14 @@ import { useCallback, useLayoutEffect, useRef, useState } from 'react';
/**
* How the 3D map's bottom row fits between the side panels: `full` with every
* label, `compact` with the layer pill on its icons, and `stacked` with the
* grade legend on a row of its own above the dock as well.
* label, `compact` with the layer pill on its icons, `stacked` with the grade
* legend on a row of its own above the dock as well, and `side` with the layer
* pill standing on the map's trailing edge, leaving the row to the dock (a map
* as narrow as the iPad's beside the tour pane).
*/
export type ControlRowFit = 'full' | 'compact' | 'stacked';
export type ControlRowFit = 'full' | 'compact' | 'stacked' | 'side';
const STEPS: readonly ControlRowFit[] = ['full', 'compact', 'stacked'];
const STEPS: readonly ControlRowFit[] = ['full', 'compact', 'stacked', 'side'];
/**
* Steps the row down while its content is wider than the room between the