From 6d093d1102596025b601b4fd0aaf7adc7122e298 Mon Sep 17 00:00:00 2001 From: Maurice Date: Fri, 6 Nov 2026 12:37:00 +0100 Subject: [PATCH] feat(mobile): one glass language across the day plan's controls - The rename and reorder controls beside the day's name, and the day and weather chips on the timeline card, are now round or pill glass controls of one height, so they read as tappable; the stay chips follow. - A leg between two stops is one pill, as on the desktop: the mode, the time in full weight and the distance beside it, larger and without a dot. - The timeline flows under the up-next card at a fixed 12px, whatever its height, instead of an offset that left a gap when the stop has no address. - The places bar on the map wears the day rail's glass at its 36px height. - A context menu stays inside all four edges of the screen, measured at its real size rather than mid-animation, and scrolls when taller than it. --- .../components/Map/PoiCategoryPill.test.tsx | 11 +++++ client/src/components/Map/PoiCategoryPill.tsx | 25 ++++++++-- .../shared/ContextMenu.extra.test.tsx | 23 +++++++-- client/src/components/shared/ContextMenu.tsx | 24 ++++++--- .../src/mobile/screens/trip/map/MMapArea.tsx | 1 + .../screens/trip/plan/MPlanTimeline.tsx | 49 ++++++++++++------- .../screens/trip/plan/MPlanTimelineRows.tsx | 28 +++++------ .../unit/mobile/trip/MPlanTimeline.test.tsx | 14 ++++-- .../mobile/trip/MPlanTimelineRows.test.tsx | 7 ++- 9 files changed, 129 insertions(+), 53 deletions(-) diff --git a/client/src/components/Map/PoiCategoryPill.test.tsx b/client/src/components/Map/PoiCategoryPill.test.tsx index 669255198..31aaffd7f 100644 --- a/client/src/components/Map/PoiCategoryPill.test.tsx +++ b/client/src/components/Map/PoiCategoryPill.test.tsx @@ -146,6 +146,17 @@ describe('PoiCategoryPill', () => { } }) + it('FE-COMP-POIPILL-013b: in the phone chrome the bar wears the day rail glass at its 36px height', () => { + pill({ categories: WITH_PLUGINS, fullWidth: true, phoneChrome: true }) + for (const button of screen.getAllByRole('button')) { + expect(button.style.minWidth).toBe('34px') + expect(button.style.height).toBe('28px') + } + const bar = screen.getAllByRole('button')[0].closest('[style*="overflow"]') as HTMLElement + expect(bar.style.padding).toBe('3px') + expect(bar.style.background).toBe('var(--m-glass)') + }) + it('FE-COMP-POIPILL-014: a desktop segment keeps its 34px instead of shrinking in a narrow corridor', () => { pill({ categories: WITH_PLUGINS }) for (const button of screen.getAllByRole('button')) { diff --git a/client/src/components/Map/PoiCategoryPill.tsx b/client/src/components/Map/PoiCategoryPill.tsx index a9a623b3f..d4e1c8faf 100644 --- a/client/src/components/Map/PoiCategoryPill.tsx +++ b/client/src/components/Map/PoiCategoryPill.tsx @@ -18,10 +18,23 @@ interface Props { * The phone map gives it the full width between the screen margins; on * desktop it floats, so it stays content-width there. */ fullWidth?: boolean + /** The phone shell's chrome: the glass, hairline and 36px height of the day rail + * and the tab switch above it, so the three bars read as one set. */ + phoneChrome?: boolean } // The touch target every segment keeps, however many categories there are. const SEGMENT = 34 +// On the phone the segment is as tall as a day chip; it keeps its width. +const PHONE_SEGMENT_HEIGHT = 28 + +/** The phone shell's glass, as the day rail draws it (bg/border --m-glass/--m-gbr). */ +const PHONE_GLASS: React.CSSProperties = { + background: 'var(--m-glass)', + border: '1px solid var(--m-gbr)', + backdropFilter: 'blur(24px) saturate(170%)', + WebkitBackdropFilter: 'blur(24px) saturate(170%)', +} // How far one wheel step moves the bar. Firefox counts a mouse wheel in lines and // some drivers in pages; a line moves about one segment, a page one bar width. @@ -50,10 +63,11 @@ interface SegmentProps { loading: boolean failed: boolean fullWidth?: boolean + phoneChrome?: boolean onToggle: (key: string) => void } -function Segment({ cat, on, loading, failed, fullWidth, onToggle }: Readonly) { +function Segment({ cat, on, loading, failed, fullWidth, phoneChrome, onToggle }: Readonly) { return ( )} @@ -476,15 +481,23 @@ function TimelineHeader({ tl, dayLabel, openLabel, weatherLabel, onOpenDay, onOp the browser's: while the chips overflow they pan first, and the pager takes over at their end or when they fit. */} + {/* The same glass controls as the edit header's: a round one when the day + is already named above it, a pill with the day's name otherwise. */} {tl.hotelChips.map(chip => ( :
{inner}
diff --git a/client/tests/unit/mobile/trip/MPlanTimeline.test.tsx b/client/tests/unit/mobile/trip/MPlanTimeline.test.tsx index e348b4996..02db2ac9e 100644 --- a/client/tests/unit/mobile/trip/MPlanTimeline.test.tsx +++ b/client/tests/unit/mobile/trip/MPlanTimeline.test.tsx @@ -176,14 +176,19 @@ describe('MPlanTimeline', () => { expect(screen.queryByText('Museum Rd 1')).not.toBeInTheDocument() }) - it('FE-MOB-PLTL-004: collapses the reserved space when the day has no up next', () => { + it('FE-MOB-PLTL-004: the timeline follows the up-next card in one column, and starts at the top without one', () => { const { container, unmount } = renderTimeline() - expect(card(container).style.top).toContain('216px') + // The card flows under the up-next card at a fixed gap, whatever its height, + // rather than at an offset that assumed an address line (a gap without one). + const upNext = screen.getByText('mobileTrip.upNext').closest('button') as HTMLElement + expect(upNext.nextElementSibling).toBe(card(container)) + expect(card(container).parentElement).toHaveClass('flex-col', 'gap-3') + expect(card(container).style.top).toBe('') unmount() const empty = renderTimeline({ upNext: null, rows: [], merged: [] }) expect(screen.queryByText('mobileTrip.upNext')).not.toBeInTheDocument() - expect(card(empty.container).style.top).toContain('102px') + expect(card(empty.container).previousElementSibling).toBeNull() }) }) @@ -532,7 +537,8 @@ describe('MPlanTimeline', () => { const { container } = renderTimeline({}, {}, { mode: 'edit' }) expect(screen.queryByText('mobileTrip.upNext')).not.toBeInTheDocument() - expect(card(container).style.top).toContain('140px') + // The edit header takes the up-next card's place, the timeline right under it. + expect(card(container).previousElementSibling).toContainElement(screen.getByLabelText('mobileTrip.renameDay')) }) it('FE-MOB-PLTL-026: splits the day title into city pills', () => { diff --git a/client/tests/unit/mobile/trip/MPlanTimelineRows.test.tsx b/client/tests/unit/mobile/trip/MPlanTimelineRows.test.tsx index 230d077d1..c4f60b9e3 100644 --- a/client/tests/unit/mobile/trip/MPlanTimelineRows.test.tsx +++ b/client/tests/unit/mobile/trip/MPlanTimelineRows.test.tsx @@ -390,7 +390,10 @@ describe('ConnRow', () => { const { container } = render() expect(screen.getByText('14 min')).toBeInTheDocument() - expect(screen.getByText('· 5.4 km')).toBeInTheDocument() + // The distance sits in the same pill as the time, with no dot between them. + expect(screen.getByText('5.4 km')).toBeInTheDocument() + expect(screen.getByText('14 min').parentElement).toBe(screen.getByText('5.4 km').parentElement) + expect(container.textContent).not.toContain('·') expect(container.querySelector('button')).toBeNull() }) @@ -448,7 +451,7 @@ describe('HotelConnRow', () => { expect(top.children[0].textContent).toBe('Hotel Sacher') expect(top.children[1].textContent).toContain('14 min') - expect(top.children[1].textContent).toContain('· 5.4 km') + expect(top.children[1].textContent).toContain('5.4 km') unmount() const bottom = render()