From 2a2dfec247018e030276e7d8c9356218633d9e5c Mon Sep 17 00:00:00 2001 From: Maurice Date: Sat, 7 Nov 2026 23:31:54 +0000 Subject: [PATCH] fix(mobile): large screen polish for the dashboard, the trip dock, transports, the stay chip and the journey strip - Dashboard: crossing the split size keeps every widget in the same parent (the columns dissolve into one ordered stack below it), so the currency converter is not remounted and keeps its amount and rates. - Trip dock: More is marked with the main dock's ring while one of its sections (chat, notes, links, polls, files) is on show or it is open, instead of the filled circle of a tab. - Transport cards: the status button is a flex box, so its dot shows when the card may be edited. - Day header: the stay chip's name keeps its own direction, so a Latin name in an Arabic header is cut at its end. - Journey: a folded Duo on its side (about 540px high) gets the compact cards, so the map keeps its room. - Rail: a test pins settings and administration marking their own entry. --- .../mobile/screens/dashboard/MDashboard.tsx | 37 +++++++++---------- .../mobile/screens/journey/MJourneyDetail.tsx | 8 +++- client/src/mobile/screens/trip/MTripShell.tsx | 21 ++++------- .../mobile/screens/trip/MTripShellParts.tsx | 36 +++++++++++++++++- .../screens/trip/plan/MPlanTimeline.tsx | 3 +- .../screens/trip/tabs/MTransportsTab.tsx | 2 +- client/tests/unit/mobile/MNavRail.test.tsx | 13 +++++++ .../unit/mobile/dashboard/MDashboard.test.tsx | 16 ++++++++ .../mobile/journey/MJourneyDetail.test.tsx | 17 ++++++++- .../unit/mobile/trip/MPlanTimeline.test.tsx | 2 + .../unit/mobile/trip/MTransportsTab.test.tsx | 8 ++++ .../unit/mobile/trip/MTripShell.test.tsx | 12 +++++- 12 files changed, 135 insertions(+), 40 deletions(-) diff --git a/client/src/mobile/screens/dashboard/MDashboard.tsx b/client/src/mobile/screens/dashboard/MDashboard.tsx index f766028ad..ceb4324e2 100644 --- a/client/src/mobile/screens/dashboard/MDashboard.tsx +++ b/client/src/mobile/screens/dashboard/MDashboard.tsx @@ -1,5 +1,4 @@ import React, { useEffect, useRef, useState } from 'react' -import { useIsSplit } from '../../../hooks/sizeClass' import { Archive, ArchiveRestore, ArrowRight, Bell, CalendarDays, CalendarPlus, Copy, LayoutGrid, List, MapPin, Pencil, Plus, RefreshCw, Sparkles, Trash2, Users, @@ -60,7 +59,6 @@ export default function MDashboard(): React.ReactElement { const unread = useInAppNotificationStore(s => s.unreadCount) const fetchUnreadCount = useInAppNotificationStore(s => s.fetchUnreadCount) const [menuOpen, setMenuOpen] = useState(false) - const split = useIsSplit() const { available: assistantAvailable, open: openAssistant } = useAssistantHomeLauncher() const [subOpen, setSubOpen] = useState(false) // The filter chips scroll when a language's words do not fit beside the two @@ -281,9 +279,12 @@ export default function MDashboard(): React.ReactElement { {/* Beside each other from the split size class on, the way the desktop dashboard holds them: the trips in the main column, the widgets in a - column of their own, each in the order the user set. */} -
-
+ column of their own, each in the order the user set. Narrower, both + columns dissolve (display: contents) into one stack ordered the same + way, so crossing the split size never moves a widget to another + parent and its state (the converter's amount, its rates) stays. */} +
+
{spotlight && ( )} - {(split ? dashOrder.filter(id => id === 'trips') : dashOrder).map(id => ( - {renderBlock(id)} - ))} +
{renderBlock('trips')}
+
+
+ {dashOrder.filter(id => id !== 'trips').map(id => ( +
{renderBlock(id)}
+ ))} + {widgetPlugins.length > 0 && ( +
+ +
+ )}
- {(split || widgetPlugins.length > 0) && ( -
- {split && dashOrder.filter(id => id !== 'trips').map(id => ( - {renderBlock(id)} - ))} - {widgetPlugins.length > 0 && ( -
- -
- )} -
- )}
diff --git a/client/src/mobile/screens/journey/MJourneyDetail.tsx b/client/src/mobile/screens/journey/MJourneyDetail.tsx index d18e83c3e..8c568377a 100644 --- a/client/src/mobile/screens/journey/MJourneyDetail.tsx +++ b/client/src/mobile/screens/journey/MJourneyDetail.tsx @@ -42,8 +42,12 @@ import MJourneyRecordingSheet from './MJourneyRecordingSheet' * (`embedded`): the trip's back button and controls sit on top, so the screen * drops its own back button and leaves the trip's URL alone. */ -/** A phone on its side: too short for the regular strip of cards and the map above it. */ -const SHORT_WINDOW = '(max-height: 500px)' +/** + * A phone on its side, or a folded Duo on its side (about 540px high): too short + * for the regular strip of cards and the map above it. Higher than the shell's + * 500px for that Duo, whose regular cards left the map a band under the header. + */ +const SHORT_WINDOW = '(max-height: 600px)' function subscribeShort(onChange: () => void) { const mq = window.matchMedia(SHORT_WINDOW) mq.addEventListener('change', onChange) diff --git a/client/src/mobile/screens/trip/MTripShell.tsx b/client/src/mobile/screens/trip/MTripShell.tsx index adf99d13d..30d86be58 100644 --- a/client/src/mobile/screens/trip/MTripShell.tsx +++ b/client/src/mobile/screens/trip/MTripShell.tsx @@ -2,7 +2,7 @@ import { useEffect, useLayoutEffect, useRef, useState, type ComponentType } from import { findFocusDayId, findTodayDayId } from '../../../components/Planner/today' import { takeResumeDay } from '../../../utils/resumeRoute' import { - CalendarDays, ChevronDown, ChevronLeft, Download, FileDown, List, Map as MapIcon, MoreHorizontal, PanelLeftClose, PanelLeftOpen, Plane, Route, SlidersHorizontal, Trash2, Upload, + CalendarDays, ChevronDown, ChevronLeft, Download, FileDown, List, Map as MapIcon, PanelLeftClose, PanelLeftOpen, Plane, Route, SlidersHorizontal, Trash2, Upload, } from 'lucide-react' import { useTripPlanner } from '../../../pages/tripPlanner/useTripPlanner' import { pickDockTabs } from './dockTabs' @@ -29,7 +29,7 @@ import { useDayPreviewStore } from '../../dayPreviewStore' import { useIsSplit, useIsWide } from '../../../hooks/sizeClass' import MTripRail from './MTripRail' import { - CollabSegment, CompactToggle, DayRailSteps, DocSyncButton, GlassSegment, HeaderActions, PrimaryPill, ROW_AFTER_BACK, ROW_CENTRED, + CollabSegment, CompactToggle, DayRailSteps, DockMoreButton, DocSyncButton, GlassSegment, HeaderActions, PrimaryPill, ROW_AFTER_BACK, ROW_CENTRED, } from './MTripShellParts' import { edgeFadeClass, useEdgeFade } from '../../components/useEdgeFade' import { useShortcuts } from '../../keyboard/useShortcuts' @@ -927,17 +927,12 @@ export default function MTripShell({ ) })} - + tab.id === trTab)} + onOpen={() => openSheet('mehr')} + label={t('mobileTrip.more')} + /> } diff --git a/client/src/mobile/screens/trip/MTripShellParts.tsx b/client/src/mobile/screens/trip/MTripShellParts.tsx index 3ed7a44af..ef762a035 100644 --- a/client/src/mobile/screens/trip/MTripShellParts.tsx +++ b/client/src/mobile/screens/trip/MTripShellParts.tsx @@ -1,4 +1,4 @@ -import { ChevronLeft, ChevronRight, FolderSync, List, Plus, Rows3 } from 'lucide-react'; +import { ChevronLeft, ChevronRight, FolderSync, List, MoreHorizontal, Plus, Rows3 } from 'lucide-react'; import { useCallback, useLayoutEffect, useRef, useState, type ReactNode } from 'react'; import { canManageDocSync } from '../../../components/Files/docsync/useDocSync'; import { useDocSyncOffered } from '../../../components/Files/docsync/useDocSyncOffered'; @@ -284,3 +284,37 @@ export function CompactToggle({ active, onToggle, label }: { active: boolean; on ); } + +/** + * The phone dock's More. It stands for its sections (chat, notes, files and the + * rest) while one is on show, and for itself while open: marked as a ring, as + * the main dock's More is, not filled like a tab it would then read as. + */ +export function DockMoreButton({ + open, + standsFor, + onOpen, + label, +}: { + open: boolean; + standsFor: boolean; + onOpen: () => void; + label: string; +}) { + return ( + + ); +} diff --git a/client/src/mobile/screens/trip/plan/MPlanTimeline.tsx b/client/src/mobile/screens/trip/plan/MPlanTimeline.tsx index 8ee8c4d0b..323bd4901 100644 --- a/client/src/mobile/screens/trip/plan/MPlanTimeline.tsx +++ b/client/src/mobile/screens/trip/plan/MPlanTimeline.tsx @@ -544,7 +544,8 @@ function TimelineHeader({ tl, dayLabel, openLabel, weatherLabel, onOpenDay, onOp className={`${GLASS_CHIP} min-w-[4.5rem] shrink gap-[5px] px-2.5`} > - {chip.name} + {/* Its own direction, so a Latin name in an Arabic header is cut at its end, not its start. */} + {chip.name} {chip.time && {chip.time.slice(0, 5)}} ))} diff --git a/client/src/mobile/screens/trip/tabs/MTransportsTab.tsx b/client/src/mobile/screens/trip/tabs/MTransportsTab.tsx index 27930a3cf..0f5ee6cbd 100644 --- a/client/src/mobile/screens/trip/tabs/MTransportsTab.tsx +++ b/client/src/mobile/screens/trip/tabs/MTransportsTab.tsx @@ -144,7 +144,7 @@ function TransportCard({ res, planner, shell, canEdit, compact }: { type="button" onClick={toggleStatus} aria-label={confirmed ? t('reservations.pending') : t('reservations.confirmed')} - className="-m-1 flex-none p-1" + className="-m-1 flex flex-none p-1" > diff --git a/client/tests/unit/mobile/MNavRail.test.tsx b/client/tests/unit/mobile/MNavRail.test.tsx index 978e8b51f..776910337 100644 --- a/client/tests/unit/mobile/MNavRail.test.tsx +++ b/client/tests/unit/mobile/MNavRail.test.tsx @@ -71,6 +71,19 @@ describe('MNavRail', () => { expect(within(rail()).getByRole('button', { name: 'Admin' })).toBeInTheDocument(); }); + it('FE-MOB-RAIL-012: settings and administration, and their sub pages, mark their own entry in the rail', () => { + useAuthStore.setState({ user: buildUser({ role: 'admin' }) }); + const { unmount } = render(, { initialEntries: ['/settings'] }); + expect(within(rail()).getByRole('button', { name: 'Settings' })).toHaveAttribute('aria-current', 'page'); + expect(within(rail()).getByRole('button', { name: 'Admin' })).not.toHaveAttribute('aria-current'); + unmount(); + + render(, { initialEntries: ['/admin/users'] }); + expect(within(rail()).getByRole('button', { name: 'Admin' })).toHaveAttribute('aria-current', 'page'); + expect(within(rail()).getByRole('button', { name: 'Settings' })).not.toHaveAttribute('aria-current'); + expect(within(rail()).getByRole('button', { name: 'My Trips' })).not.toHaveAttribute('aria-current'); + }); + it("FE-MOB-RAIL-004: the create button keeps the dock's meaning and its exceptions", () => { const { unmount } = render( <> diff --git a/client/tests/unit/mobile/dashboard/MDashboard.test.tsx b/client/tests/unit/mobile/dashboard/MDashboard.test.tsx index fd36e6cb2..245527447 100644 --- a/client/tests/unit/mobile/dashboard/MDashboard.test.tsx +++ b/client/tests/unit/mobile/dashboard/MDashboard.test.tsx @@ -8,6 +8,7 @@ import { useInAppNotificationStore } from '../../../../src/store/inAppNotificati import { usePluginStore } from '../../../../src/store/pluginStore'; import type { TripCardBadge } from '../../../../src/api/client'; import type { DashboardTrip } from '../../../../src/pages/dashboard/dashboardModel'; +import { setSizeClass } from '../../../helpers/sizeClass'; // FE-MOB-DASH-001 onwards @@ -416,6 +417,21 @@ describe('MDashboard', () => { expect(screen.getByText('Upcoming reservations')).toBeInTheDocument(); }); + it('FE-MOB-DASH-041: crossing the split size keeps the widgets mounted, so the converter keeps its amount', () => { + mocks.dash = buildDash(); + render(); + const amount = screen.getAllByRole('textbox', { name: 'From' })[0] as HTMLInputElement; + fireEvent.change(amount, { target: { value: '250' } }); + + setSizeClass('split'); + expect(screen.getAllByRole('textbox', { name: 'From' })[0]).toBe(amount); + expect(amount.value).toBe('250'); + + setSizeClass('compact'); + expect(screen.getAllByRole('textbox', { name: 'From' })[0]).toBe(amount); + expect(amount.value).toBe('250'); + }); + it('FE-MOB-DASH-027: a malformed date renders a dash instead of crashing', () => { mocks.dash = buildDash({ gridTrips: [buildTrip({ id: 14, start_date: 'not-a-date', end_date: iso(3) })] }); render(); diff --git a/client/tests/unit/mobile/journey/MJourneyDetail.test.tsx b/client/tests/unit/mobile/journey/MJourneyDetail.test.tsx index cf379564e..b8ea512f9 100644 --- a/client/tests/unit/mobile/journey/MJourneyDetail.test.tsx +++ b/client/tests/unit/mobile/journey/MJourneyDetail.test.tsx @@ -1,5 +1,5 @@ // FE-MOB-JDET-001 to FE-MOB-JDET-048 -import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; +import { describe, it, expect, beforeEach, afterEach, onTestFinished, vi } from 'vitest'; import { render, screen, fireEvent, waitFor, act } from '../../../helpers/render'; import { setSizeClass } from '../../../helpers/sizeClass'; import MJourneyDetail from '../../../../src/mobile/screens/journey/MJourneyDetail'; @@ -246,6 +246,21 @@ afterEach(() => { // ── Tests ──────────────────────────────────────────────────────────────────── describe('MJourneyDetail', () => { + it('FE-MOB-JDET-049: a folded Duo on its side (540px high) gets the compact cards, so the map keeps its room', () => { + const real = window.matchMedia; + // Height queries answered for a window 540px high; the rest as the setup answers them. + const tall = (query: string): MediaQueryList => { + const max = /\(\s*max-height:\s*(\d+)px\s*\)/.exec(query); + const list = real(query); + return max ? ({ ...list, matches: 540 <= Number(max[1]), media: query } as MediaQueryList) : list; + }; + window.matchMedia = tall; + onTestFinished(() => { window.matchMedia = real; }); + setup(); + expect(document.querySelector('.h-\\[112px\\]')).toBeInTheDocument(); + expect(document.querySelector('.h-\\[152px\\]')).not.toBeInTheDocument(); + }); + it('FE-MOB-JDET-001: shows a spinner while the journey is loading', () => { setup({ loading: true, current: null }); expect(document.querySelector('.animate-spin')).toBeInTheDocument(); diff --git a/client/tests/unit/mobile/trip/MPlanTimeline.test.tsx b/client/tests/unit/mobile/trip/MPlanTimeline.test.tsx index 119130210..d6178df82 100644 --- a/client/tests/unit/mobile/trip/MPlanTimeline.test.tsx +++ b/client/tests/unit/mobile/trip/MPlanTimeline.test.tsx @@ -221,6 +221,8 @@ describe('MPlanTimeline', () => { // The name gives way with an ellipsis; the time after it stays, with no dot between. const sacher = screen.getByText('Hotel Sacher') expect(sacher).toHaveClass('truncate', 'min-w-0') + // In an Arabic header a Latin name keeps its own direction, so the ellipsis lands at its end. + expect(sacher).toHaveAttribute('dir', 'auto') expect(sacher.closest('button')).toHaveTextContent('Hotel Sacher11:00') expect(sacher.closest('button')).toHaveClass('shrink') expect(screen.getByText('Ryokan Kyoto').closest('button')).toHaveTextContent('Ryokan Kyoto15:00') diff --git a/client/tests/unit/mobile/trip/MTransportsTab.test.tsx b/client/tests/unit/mobile/trip/MTransportsTab.test.tsx index ca14d687f..4a4033a82 100644 --- a/client/tests/unit/mobile/trip/MTransportsTab.test.tsx +++ b/client/tests/unit/mobile/trip/MTransportsTab.test.tsx @@ -243,6 +243,14 @@ describe('MTransportsTab', () => { await waitFor(() => expect(p.tripActions.toggleReservationStatus).toHaveBeenCalledWith(7, 101)) }) + it('FE-MOB-TRTAB-029: the dot inside the status button is laid out as a box, so it shows', () => { + renderTab(planner()) + const toggle = within(cardOf('HND to ITM')).getByRole('button', { name: 'reservations.pending' }) + // The dot is a bare span sized by width and height: only a flex (or block) parent gives it its box. + expect(toggle).toHaveClass('flex') + expect(toggle.querySelector('span')).toHaveClass('h-[7px]', 'w-[7px]') + }) + it('FE-MOB-TRTAB-017: toasts when the status toggle fails', async () => { const p = planner() vi.mocked(p.tripActions.toggleReservationStatus).mockRejectedValueOnce(new Error('offline')) diff --git a/client/tests/unit/mobile/trip/MTripShell.test.tsx b/client/tests/unit/mobile/trip/MTripShell.test.tsx index 60c5c8598..9d2b9e59a 100644 --- a/client/tests/unit/mobile/trip/MTripShell.test.tsx +++ b/client/tests/unit/mobile/trip/MTripShell.test.tsx @@ -421,10 +421,20 @@ describe('MTripShell', () => { expect(more).toHaveAttribute('aria-expanded', 'false') fireEvent.click(more) expect(more).toHaveAttribute('aria-expanded', 'true') - expect(more).toHaveClass('bg-m-act') + // A ring, as the main dock marks its More, not the fill of a tab. + expect(more).toHaveClass('ring-[1.5px]') + expect(more).not.toHaveClass('bg-m-act') expect(plan).not.toHaveAttribute('aria-current') act(() => { shellApi.closeSheet() }) expect(plan).toHaveAttribute('aria-current', 'page') + expect(more).not.toHaveClass('ring-[1.5px]') + }) + + it('FE-MOB-SHELL-098: a section reached through More marks More with the ring while it is on show', () => { + renderShell({ activeTab: 'dateien' } as Partial) + const more = screen.getByRole('button', { name: 'mobileTrip.more' }) + expect(more).toHaveAttribute('aria-current', 'page') + expect(more).toHaveClass('ring-[1.5px]') expect(more).not.toHaveClass('bg-m-act') })