feat(mobile): phone styling for tours list, trip settings and admin cards

The tours list in the places browser now uses the same rows as places: a
grade or type tile, the day plan's figure badges and a day badge or plus on
the right. A shared "Planned on desktop" badge replaces the grey hint box
there and sits under the road trip's empty stage.

Trip settings and trip edit open phone sheets instead of the desktop
dialogs; the edit sheet gains the day count of a dateless trip and the
reminder. Questions are asked in phone sheets, not the browser.

Admin on the phone: the paddle regions and school holiday cards are phone
cards on their shared hooks, long addon descriptions fold to two lines,
the addon header keeps the wordmark inside its sentence, the group bands
drop the dash and the permissions actions get a row of their own. The
Tours addon gets its catalog name and description in every locale.

The journey map on the phone shows every layer without the switch bar.
This commit is contained in:
Maurice
2026-10-22 21:26:41 +02:00
parent bb3c0151d5
commit 49afee161d
151 changed files with 2660 additions and 899 deletions
@@ -89,6 +89,12 @@ describe('JourneyLayeredMap', () => {
expect(last().photos).toBeUndefined();
});
it('FE-JOURNEY-LAYEREDMAP-002b: the phone draws the layers without their switches', () => {
render(<JourneyLayeredMap layers={layers()} hideLayerControl checkins={[]} entries={[]} photos={PHOTOS} />);
expect(last()).toMatchObject({ marks: [MARK], layerVisibility: ALL_VISIBLE });
expect(screen.queryByRole('group', { name: 'Map layers' })).toBeNull();
});
it('FE-JOURNEY-LAYEREDMAP-003: a picked mark opens its card, which goes when its layer is switched off', () => {
const onOpenEntry = vi.fn();
const { rerender } = render(
@@ -20,8 +20,8 @@ interface Props extends MapProps {
layers?: JourneyMapLayersView | null;
/** A shared page and the phone timeline draw with Leaflet whatever a setting says. */
engine?: 'auto' | 'leaflet';
/** Icon-only switches, for a phone. */
compactControls?: boolean;
/** No layer switches: the phone keeps its map clear and shows every layer (the picked card still opens). */
hideLayerControl?: boolean;
/** How far from the map's top the switches sit, clear of a bar laid over the map. */
controlsTop?: number | string;
/** Leads from a picked place or stay to its entry. */
@@ -40,7 +40,7 @@ export default function JourneyLayeredMap({
ref,
layers,
engine = 'auto',
compactControls = false,
hideLayerControl = false,
controlsTop = 12,
onOpenEntry,
entryTitleOf,
@@ -88,9 +88,11 @@ export default function JourneyLayeredMap({
className="pointer-events-none absolute inset-x-3 z-10 flex flex-col items-start gap-2"
style={{ top: controlsTop }}
>
<div className="pointer-events-auto max-w-full">
<JourneyMapLayerControl layers={layers} compact={compactControls} />
</div>
{!hideLayerControl && (
<div className="pointer-events-auto max-w-full">
<JourneyMapLayerControl layers={layers} />
</div>
)}
{card && (
<JourneyMapPickCard
key={card.key}
@@ -115,7 +115,7 @@ export default function MobileMapTimeline({
ref={mapRef}
engine="leaflet"
layers={layers}
compactControls
hideLayerControl
controlsTop={controlsTop}
onOpenEntry={handleMarkerClick}
entryTitleOf={entryTitleOf}
@@ -155,7 +155,7 @@ export default function MobileMapTimeline({
ref={mapRef}
engine="leaflet"
layers={layers}
compactControls
hideLayerControl
controlsTop={controlsTop}
onOpenEntry={handleMarkerClick}
entryTitleOf={entryTitleOf}
@@ -111,6 +111,33 @@ describe('useJourneyMapLayers', () => {
});
});
it('FE-JOURNEY-MAPLAYERS-HOOK-002b: the phone shows every layer whatever was kept, and keeps no switch', () => {
vi.spyOn(journeyMapRepo, 'layers').mockResolvedValue({
places: { status: 'ok', items: [] },
routes: { status: 'ok', items: [] },
stays: { status: 'ok', items: [] },
});
localStorage.setItem('trek:journey-map-layers:8', JSON.stringify({ plan: false, entries: false }));
const { result } = renderHook(() =>
useJourneyMapLayers({
source: { journeyId: 8 },
entryIdsOnMap: NO_ENTRIES,
photoCount: 0,
colorOfDay,
dateOfEntry,
allLayers: true,
})
);
expect(result.current.visibility).toMatchObject({ plan: true, entries: true, recorded: true, photos: true });
act(() => result.current.toggle('photos'));
expect(result.current.visibility.photos).toBe(false);
expect(JSON.parse(localStorage.getItem('trek:journey-map-layers:8') ?? '{}')).toEqual({
plan: false,
entries: false,
});
});
it('FE-JOURNEY-MAPLAYERS-HOOK-003: a read that fails says so on the plan and the entries, and the recordings still draw', async () => {
vi.spyOn(journeyMapRepo, 'layers').mockRejectedValue(new Error('down'));
const recorded: JourneyTrack = {
@@ -50,6 +50,12 @@ interface Options {
colorOfDay: (date: string) => string | null;
/** The day an entry is on, for the colour of its stays. */
dateOfEntry: (entryId: number) => string | null;
/**
* Every layer on, whatever this browser kept: the phone shows no switches,
* so a layer once switched off there would stay off with no way back. A
* switch that is still offered then holds only for the visit.
*/
allLayers?: boolean;
}
const NO_TRACKS: JourneyTrack[] = [];
@@ -119,13 +125,14 @@ export function useJourneyMapLayers({
recordedRead = 'ready',
colorOfDay,
dateOfEntry,
allLayers = false,
}: Options): JourneyMapLayersView {
const { t, locale } = useTranslation();
const journeyId = source && 'journeyId' in source ? source.journeyId : null;
const token = source && 'token' in source ? source.token : null;
const storageKey =
journeyId !== null ? layersStorageKey({ journeyId }) : token !== null ? layersStorageKey({ token }) : null;
const { visibility, toggle } = useLayerSwitches(storageKey);
const { visibility, toggle } = useLayerSwitches(allLayers ? null : storageKey);
const sourceKey = journeyId !== null ? `j:${journeyId}` : token !== null ? `s:${token}` : null;
// A shared page reads once; a journey's own map only while the plan or the entries are shown.