mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-28 23:50:08 +00:00
fix(journey): open the entry when its marker card is tapped on the phone
On the phone journey screen and the public share page on a phone, a tap on a numbered pin brings up the entry's card above it, but the card could not be tapped: the GL popup and the Leaflet tooltip both let the pointer fall through to the map, and no phone host gave the card anything to do. The map now takes onMarkerCardClick, and both renderers make the card open that entry once a host wires it. The GL popup handles it in its delegated listener next to the photo strip, which keeps opening the photos where the desktop asks for that. Leaflet handles it on the tooltip element itself: a press that reached the map container let Leaflet focus the map, which blurred the pin and closed the card before its click landed. The phone screen and the timeline open the entry through the carousel hook, the same way a tap on the active card does. The desktop asides keep the card as a hover label. The unused hideMarkerTooltip prop goes, together with the docs that still said the phone hides the card. Closes #2885
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// FE-MOB-JDET-001 to FE-MOB-JDET-045
|
||||
// FE-MOB-JDET-001 to FE-MOB-JDET-046
|
||||
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
||||
import { render, screen, fireEvent, waitFor, act } from '../../../helpers/render';
|
||||
import MJourneyDetail from '../../../../src/mobile/screens/journey/MJourneyDetail';
|
||||
@@ -30,11 +30,15 @@ vi.mock('../../../../src/components/Journey/JourneyMapAuto', async () => {
|
||||
}));
|
||||
const entries = props.entries as { id: string }[];
|
||||
const onMarkerClick = props.onMarkerClick as ((id: string) => void) | undefined;
|
||||
const onMarkerCardClick = props.onMarkerCardClick as ((id: string) => void) | undefined;
|
||||
return (
|
||||
<div data-testid="journey-map" data-active={String(props.activeMarkerId ?? '')} data-dark={String(props.dark)}>
|
||||
{entries.map(e => (
|
||||
<button key={e.id} type="button" onClick={() => onMarkerClick?.(e.id)}>{`marker-${e.id}`}</button>
|
||||
))}
|
||||
{onMarkerCardClick && entries.map(e => (
|
||||
<button key={`card-${e.id}`} type="button" onClick={() => onMarkerCardClick(e.id)}>{`marker-card-${e.id}`}</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
@@ -282,6 +286,12 @@ describe('MJourneyDetail', () => {
|
||||
expect(screen.getByTestId('journey-map')).toHaveAttribute('data-active', '2');
|
||||
});
|
||||
|
||||
it('FE-MOB-JDET-046: a tap on a marker card opens that entry in the sheet (#2885)', () => {
|
||||
const { hook } = setup();
|
||||
fireEvent.click(screen.getByRole('button', { name: 'marker-card-2' }));
|
||||
expect(hook.setEditingEntry).toHaveBeenCalledWith(expect.objectContaining({ id: 2 }));
|
||||
});
|
||||
|
||||
it('FE-MOB-JDET-007: a marker without a matching entry leaves the selection alone', () => {
|
||||
const current = buildDetail();
|
||||
setup({
|
||||
|
||||
Reference in New Issue
Block a user