fix(journey): gallery actions on tablets, tracks switch on phones (#2194)

Between 768 and 1023px the view-controls row is hidden and the provider and upload buttons had moved into it, leaving no way to add photos; the gallery actions render below the floating bar there now. The mobile journey settings sheet gets the linked-trip tracks switch the desktop dialog got, and the request gate and the fitBounds behaviour are pinned by tests.
This commit is contained in:
Maurice
2026-09-02 19:00:48 +02:00
committed by Maurice
parent 088eef6c6b
commit 9cc427d156
6 changed files with 262 additions and 29 deletions
@@ -1,4 +1,4 @@
// FE-COMP-JOURNEYMAP-001 to FE-COMP-JOURNEYMAP-027
// FE-COMP-JOURNEYMAP-001 to FE-COMP-JOURNEYMAP-049
vi.mock('../../api/websocket', () => ({
connect: vi.fn(),
@@ -604,6 +604,39 @@ describe('JourneyMap', () => {
expect(colors).not.toContain('#ffffff');
});
/** The opening viewport is the assertion here, so the frame gets read out of the bounds call. */
const fitCoords = () => vi.mocked(L.latLngBounds).mock.calls[0][0] as [number, number][];
// #2194: a recorded drive across the country used to pull the opening view out to
// the whole trip, leaving the journey's own entries as a speck.
it('FE-COMP-JOURNEYMAP-048: frames the entries, not the tracks, when the journey has both', () => {
const origRAF = globalThis.requestAnimationFrame;
globalThis.requestAnimationFrame = (cb: FrameRequestCallback) => { cb(0); return 0; };
try {
render(
<JourneyMap checkins={[]} entries={entriesWithCoords} tracks={[track({ points: [[10, 10], [11, 11]] })]} />
);
expect(mockedMap().fitBounds).toHaveBeenCalled();
expect(fitCoords()).toEqual([[48.8566, 2.3522], [52.52, 13.405]]);
} finally {
globalThis.requestAnimationFrame = origRAF;
}
});
it('FE-COMP-JOURNEYMAP-049: with nothing else on the map the tracks are framed instead of the world', () => {
const origRAF = globalThis.requestAnimationFrame;
globalThis.requestAnimationFrame = (cb: FrameRequestCallback) => { cb(0); return 0; };
try {
render(<JourneyMap checkins={[]} entries={entriesWithoutCoords} tracks={[track()]} />);
expect(fitCoords()).toEqual([[47.1, 11.2], [47.2, 11.3]]);
expect(mockedMap().setView).not.toHaveBeenCalledWith([30, 0], 2);
} finally {
globalThis.requestAnimationFrame = origRAF;
}
});
// A string handed to bindTooltip becomes innerHTML. A track name is a place
// name off a shared trip and an entry label is a journey title, so both are
// written by someone who is not necessarily the person reading the map — and