Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(mobile): the trip's screens on an iPad and an unfolded foldable, nothing cut or covered

Maurice8955790f1764
diff --git a/client/scripts/theme-baseline.json b/client/scripts/theme-baseline.json
index d16268694..97e40bebc 100644
--- a/client/scripts/theme-baseline.json
+++ b/client/scripts/theme-baseline.json
@@ -214,7 +214,7 @@
"mobile/screens/settings/MSettingsUi.tsx": 11,
"mobile/screens/settings/MWebPushCard.tsx": 1,
"mobile/screens/trip/MTripLoadingSplash.tsx": 2,
- "mobile/screens/trip/MTripShell.tsx": 8,
+ "mobile/screens/trip/MTripShell.tsx": 7,
"mobile/screens/trip/places/MPlacesBrowser.tsx": 10,
"mobile/screens/trip/places/MPlacesBulkCategorySheet.tsx": 2,
"mobile/screens/trip/places/MPlacesFilterControls.tsx": 1,
diff --git a/client/src/mobile/components/MChipStrip.tsx b/client/src/mobile/components/MChipStrip.tsx
new file mode 100644
index 000000000..84e676da0
--- /dev/null
+++ b/client/src/mobile/components/MChipStrip.tsx
@@ -0,0 +1,35 @@
+import { useState, type ReactNode } from 'react';
+
+import { edgeFadeClass, useEdgeFade } from './useEdgeFade';
+
+/**
+ * A row of chips that scrolls sideways once it is wider than its room, and
+ * fades out at an edge with more behind it, the way the trip's day strip does,
+ * so a chip cut by the edge reads as "the row goes on" rather than as a word
+ * cut in half. It shrinks to its room in a row it shares (min-width 0), so a
+ * button beside it stays beside it instead of covering the chips.
+ */
+export default function MChipStrip({
+ children,
+ className = '',
+ label,
+}: {
+ children: ReactNode;
+ /** Layout of the row itself: gap, alignment, growth. */
+ className?: string;
+ /** Names the group for a screen reader, where the chips are a set of filters. */
+ label?: string;
+}) {
+ const [strip, setStrip] = useState<HTMLDivElement | null>(null);
+ const fade = useEdgeFade(strip);
+ return (
+ <div
+ ref={setStrip}
+ role={label ? 'group' : undefined}
+ aria-label={label}
+ className={`flex min-w-0 overflow-x-auto ${edgeFadeClass(fade)} ${className}`}
+ >
+ {children}
+ </div>
+ );
+}
diff --git a/client/src/mobile/components/useEdgeFade.ts b/client/src/mobile/components/useEdgeFade.ts
index 3619cdaac..1ef590ffd 100644
--- a/client/src/mobile/components/useEdgeFade.ts
+++ b/client/src/mobile/components/useEdgeFade.ts
@@ -7,49 +7,55 @@ export interface EdgeFade {
end: boolean;
}
-/** x: a horizontal strip, y: a vertical scroll box such as a form sheet's body. */
-export type EdgeFadeAxis = 'x' | 'y';
+/** Which way a scroller runs: a strip of chips sideways, a list or a card down. */
+export type FadeAxis = 'x' | 'y';
const NONE: EdgeFade = { start: false, end: false };
/**
* Which ends of a scroller have more behind them, so it can fade out there
* (m-fade-s / m-fade-e, m-fade-t / m-fade-b in mobile.css) instead of cutting a
- * chip or a field in half with nothing to say the content goes on. Follows
- * scrolling and every change of size: a rotation, a fold, the pane beside the
- * map opening, and on the vertical axis content that grows or shrinks inside
- * a box that keeps its height.
+ * chip or a row in half with nothing to say the content goes on. Follows
+ * scrolling, every change of size (a rotation, a fold, the pane beside the map
+ * opening) and every change of what it holds (a day switched, a message in).
*/
-export function useEdgeFade(el: HTMLElement | null, axis: EdgeFadeAxis = 'x'): EdgeFade {
+export function useEdgeFade(el: HTMLElement | null, axis: FadeAxis = 'x'): EdgeFade {
const [fade, setFade] = useState<EdgeFade>(NONE);
useEffect(() => {
if (!el) return;
const measure = () => {
// scrollLeft runs from 0 towards the negative in a right-to-left strip.
- const scrolled = axis === 'x' ? Math.abs(el.scrollLeft) : el.scrollTop;
+ const scrolled = Math.abs(axis === 'x' ? el.scrollLeft : el.scrollTop);
const room = axis === 'x' ? el.scrollWidth - el.clientWidth : el.scrollHeight - el.clientHeight;
const next = { start: scrolled > 1, end: room - scrolled > 1 };
setFade((prev) => (prev.start === next.start && prev.end === next.end ? prev : next));
};
measure();
el.addEventListener('scroll', measure, { passive: true });
- const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure);
- observer?.observe(el);
- // A form's fields come and go (a booking type, a split mode), which changes
- // what there is to scroll without changing the box itself.
- const content = axis === 'y' && typeof MutationObserver !== 'undefined' ? new MutationObserver(measure) : null;
- content?.observe(el, { childList: true, subtree: true });
+ const resize = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure);
+ resize?.observe(el);
+ // New content changes what lies past an edge without changing the box itself.
+ let frame = 0;
+ const changed =
+ typeof MutationObserver === 'undefined'
+ ? null
+ : new MutationObserver(() => {
+ cancelAnimationFrame(frame);
+ frame = requestAnimationFrame(measure);
+ });
+ changed?.observe(el, { childList: true, subtree: true, characterData: true });
return () => {
el.removeEventListener('scroll', measure);
- observer?.disconnect();
- content?.disconnect();
+ resize?.disconnect();
+ changed?.disconnect();
+ cancelAnimationFrame(frame);
};
}, [el, axis]);
return fade;
}
-/** The mask classes for a fade state. */
-export function edgeFadeClass(fade: EdgeFade, axis: EdgeFadeAxis = 'x'): string {
+/** The mask classes for a fade state: sideways by default, `y` for a scroller that runs down. */
+export function edgeFadeClass(fade: EdgeFade, axis: FadeAxis = 'x'): string {
const [both, start, end] =
axis === 'x' ? ['m-fade-se', 'm-fade-s', 'm-fade-e'] : ['m-fade-tb', 'm-fade-t', 'm-fade-b'];
if (fade.start && fade.end) return both;
diff --git a/client/src/mobile/mobile.css b/client/src/mobile/mobile.css
index af1b9b5fd..34a4eed13 100644
--- a/client/src/mobile/mobile.css
+++ b/client/src/mobile/mobile.css
@@ -34,6 +34,9 @@
--m-mkr: #101013;
--m-mkfg: #fff;
--m-trackoff: rgba(16,16,19,.14);
+ /* The edge of an empty checkbox: at least 3:1 against a row, so an open item
+ * shows its box rather than reading as plain text. */
+ --m-checkbr: rgba(16,16,19,.55);
/* Strength of a dayTintProvider plugin's colour on an inactive day chip. A notch
* above the desktop badge: the chip has no neutral base under it, so a softer tint
@@ -103,6 +106,7 @@ html[dir='rtl']:has(.m-shell[data-size='wide'], .m-shell[data-size='split']) .m-
--m-mkr: #F5F5F7;
--m-mkfg: #101013;
--m-trackoff: rgba(255,255,255,.14);
+ --m-checkbr: rgba(255,255,255,.4);
--day-tint-chip: 28%;
}
@@ -679,7 +683,8 @@ html:has(.m-shell) ::-webkit-scrollbar {
.m-fade-s,
.m-fade-e,
.m-fade-se {
- --m-fade-w: 28px;
+ /* A strip with a chevron over its faded end fades wider (--m-fade-reach). */
+ --m-fade-w: var(--m-fade-reach, 28px);
-webkit-mask-image: var(--m-fade-mask);
mask-image: var(--m-fade-mask);
}
@@ -704,7 +709,7 @@ html:has(.m-shell) ::-webkit-scrollbar {
.m-fade-t,
.m-fade-b,
.m-fade-tb {
- --m-fade-h: 24px;
+ --m-fade-h: var(--m-fade-reach-y, 24px);
-webkit-mask-image: var(--m-fade-vmask);
mask-image: var(--m-fade-vmask);
}
@@ -771,3 +776,33 @@ html:has(.m-shell) ::-webkit-scrollbar {
display: none;
}
}
+
+/* A segmented control in the trip's top bar that does not fit between the back
+ button and the trailing button draws its segments tighter first
+ (MTripShellParts GlassSegment), and scrolls only where that is not enough. */
+.m-seg[data-tight='true'] > * {
+ padding-inline: 10px;
+}
+/* A one-line Markdown caption (MarkdownText clamp: an address, a note in a
+ row) ends in an ellipsis. The clamp sits on the wrapper, but the text is in
+ the paragraph inside it, so the line was cut off mid-letter at the row's
+ edge or under its buttons with nothing to say it went on. */
+.m-root .collab-note-md.truncate > * {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+/* The trip's shared links in the touch shell (CollabLinks in MCollabTab). Their
+ edit, pin and delete buttons are always out on a touch screen, so a link in
+ one of two columns kept a sliver for its title ("JR seat / reservations") and
+ cut its host. One column, until the board has room for two links side by
+ side with their titles on one line. */
+.m-root .collab-link-grid__cells {
+ grid-template-columns: minmax(0, 1fr);
+}
+@container (min-width: 720px) {
+ .m-root .collab-link-grid__cells {
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+}
diff --git a/client/src/mobile/screens/trip/MTripShell.tsx b/client/src/mobile/screens/trip/MTripShell.tsx
index 3c9d59459..adf99d13d 100644
--- a/client/src/mobile/screens/trip/MTripShell.tsx
+++ b/client/src/mobile/screens/trip/MTripShell.tsx
@@ -1,8 +1,8 @@
-import { useEffect, useLayoutEffect, useRef, useState, type ComponentType, type ReactNode } from 'react'
+import { useEffect, useLayoutEffect, useRef, useState, type ComponentType } from 'react'
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, Plus, Route, SlidersHorizontal, Trash2, Upload,
+ CalendarDays, ChevronDown, ChevronLeft, Download, FileDown, List, Map as MapIcon, MoreHorizontal, PanelLeftClose, PanelLeftOpen, Plane, Route, SlidersHorizontal, Trash2, Upload,
} from 'lucide-react'
import { useTripPlanner } from '../../../pages/tripPlanner/useTripPlanner'
import { pickDockTabs } from './dockTabs'
@@ -28,7 +28,9 @@ import { getIntlLanguage } from '@trek/shared'
import { useDayPreviewStore } from '../../dayPreviewStore'
import { useIsSplit, useIsWide } from '../../../hooks/sizeClass'
import MTripRail from './MTripRail'
-import { CollabSegment, CompactToggle, DocSyncButton, GlassSegment } from './MTripShellParts'
+import {
+ CollabSegment, CompactToggle, DayRailSteps, DocSyncButton, GlassSegment, HeaderActions, PrimaryPill, ROW_AFTER_BACK, ROW_CENTRED,
+} from './MTripShellParts'
import { edgeFadeClass, useEdgeFade } from '../../components/useEdgeFade'
import { useShortcuts } from '../../keyboard/useShortcuts'
import { tripCreateIntent } from '../../../components/Layout/useCreateAction'
@@ -638,8 +640,9 @@ export default function MTripShell({
<div className={`absolute end-4 start-[calc(var(--m-rail-w,0px)+16px)] z-[25] flex gap-[6px] top-[calc(var(--m-safe-top,12px)+50px)] ${chromeSpan}`}>
{/* The glass is the outer box, the scroller sits inside its padding: that way
the fade at an edge that runs on takes the chips, not the glass's rim. */}
- <div className="flex min-w-0 flex-1 rounded-full border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] p-[3px] backdrop-blur-[24px] backdrop-saturate-[1.7]">
- <div ref={setDayRail} className={`relative flex min-w-0 flex-1 items-center gap-[2px] overflow-x-auto rounded-full ${edgeFadeClass(dayFade)}`}>
+ <div className="relative flex min-w-0 flex-1 rounded-full border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] p-[3px] backdrop-blur-[24px] backdrop-saturate-[1.7]">
+ <DayRailSteps rail={dayRail} fade={dayFade} />
+ <div ref={setDayRail} className={`relative flex min-w-0 flex-1 items-center gap-[2px] overflow-x-auto rounded-full wide:[--m-fade-reach:52px] ${edgeFadeClass(dayFade)}`}>
{dayPill && (
<span
aria-hidden="true"
@@ -664,7 +667,7 @@ export default function MTripShell({
// the active chip's bg-m-act class.
style={active ? undefined : { background: dayTintBackground(tint, 'badge', '--day-tint-chip') }}
data-today={isToday || undefined}
- className={`relative flex flex-1 items-center justify-center gap-[3px] whitespace-nowrap rounded-full px-3 py-[5px] text-center text-[0.75rem] font-semibold transition-colors duration-200 ${
+ className={`relative flex flex-1 items-center justify-center gap-[3px] whitespace-nowrap rounded-full px-3 py-[5px] text-center text-[0.75rem] font-semibold transition-colors duration-200 wide:scroll-mx-[48px] ${
active ? `text-m-actfg ${dayPill ? '' : 'bg-m-act'}` : 'text-m-ink'
} ${isToday && !active ? 'ring-[1.5px] ring-inset ring-[color:var(--m-st-info)]' : ''}`}
>
@@ -712,7 +715,7 @@ export default function MTripShell({
</MIconBtn>
{trTab === 'plan' && (
- <GlassSegment>
+ <GlassSegment activeKey={`${mode}:${view}:${language}`}>
{([
{ value: 'go' as const, label: t('mobileTrip.travel') },
{ value: 'edit' as const, label: t('trip.mobilePlan') },
@@ -722,7 +725,8 @@ export default function MTripShell({
key={seg.value}
type="button"
onClick={() => setTravelMode(seg.value)}
- className={`whitespace-nowrap rounded-full px-4 py-2 text-[0.8125rem] ${
+ aria-pressed={mode === seg.value && view !== 'map'}
+ className={`flex-none whitespace-nowrap rounded-full px-4 py-2 text-[0.8125rem] ${
mode === seg.value && view !== 'map' ? 'bg-m-act font-semibold text-m-actfg' : 'font-medium text-m-ink'
}`}
>
@@ -733,8 +737,9 @@ export default function MTripShell({
)}
{trTab === 'transports' && (
- <div className="absolute start-[52px] end-2 top-1/2 flex -translate-y-1/2 items-center justify-center gap-[7px]">
- <PrimaryPill
+ <HeaderActions
+ phone={ROW_AFTER_BACK}
+ primary={<PrimaryPill
label={t('transport.addTransport')}
onClick={() => {
planner.setEditingTransport(null)
@@ -742,7 +747,8 @@ export default function MTripShell({
planner.setTransportModalAutomated(false)
planner.setShowTransportModal(true)
}}
- />
+ />}
+ >
{planner.bookingImportAvailable && (
<MIconBtn ariaLabel={t('reservations.import.title')} onClick={() => { planner.setBookingImportKind('transports'); planner.setShowBookingImport(true) }} size={40} className="text-m-muted backdrop-blur-[24px] backdrop-saturate-[1.7]">
<Download size={15} strokeWidth={2} />
@@ -754,36 +760,37 @@ export default function MTripShell({
</MIconBtn>
)}
<CompactToggle active={transportsCompact} onToggle={() => setTransportsCompact(v => !v)} label={t('mobileTrip.compactView')} />
- </div>
+ </HeaderActions>
)}
{trTab === 'buchungen' && (
- <div className="absolute start-[52px] end-2 top-1/2 flex -translate-y-1/2 items-center justify-center gap-[7px]">
- <PrimaryPill
+ <HeaderActions
+ phone={ROW_AFTER_BACK}
+ primary={<PrimaryPill
label={t('mobileTrip.newReservation')}
onClick={() => { planner.setEditingReservation(null); planner.setShowReservationModal(true) }}
- />
+ />}
+ >
{planner.bookingImportAvailable && (
<MIconBtn ariaLabel={t('reservations.import.title')} onClick={() => { planner.setBookingImportKind('bookings'); planner.setShowBookingImport(true) }} size={40} className="text-m-muted backdrop-blur-[24px] backdrop-saturate-[1.7]">
<Download size={15} strokeWidth={2} />
</MIconBtn>
)}
<CompactToggle active={bookingsCompact} onToggle={() => setBookingsCompact(v => !v)} label={t('mobileTrip.compactView')} />
- </div>
+ </HeaderActions>
)}
{trTab === 'finanzplan' && (
- <div className="absolute inset-x-0 top-1/2 mx-auto flex w-fit -translate-y-1/2 items-center gap-[7px]">
- <PrimaryPill label={t('costs.addExpense')} onClick={() => setAddExpenseSignal(s => s + 1)} />
+ <HeaderActions phone={ROW_CENTRED} primary={<PrimaryPill label={t('costs.addExpense')} onClick={() => setAddExpenseSignal(s => s + 1)} />}>
<MReceiptScanButton tripId={tripId} canEdit={planner.can('budget_edit', trip)} />
<MIconBtn ariaLabel={t('budget.exportCsv')} onClick={() => setExportCostsCsvSignal(s => s + 1)} size={40} className="text-m-muted backdrop-blur-[24px] backdrop-saturate-[1.7]">
<FileDown size={15} strokeWidth={2} />
</MIconBtn>
- </div>
+ </HeaderActions>
)}
{trTab === 'listen' && (
- <GlassSegment>
+ <GlassSegment activeKey={`${listsTab}:${language}:${packedCount}:${todoOpenCount}`}>
{([
{ value: 'packing' as const, label: t('todo.subtab.packing'), count: `${packedCount}/${packingItems.length}` },
{ value: 'todo' as const, label: t('todo.subtab.todo'), count: t('mobileTrip.todoOpenCount', { count: todoOpenCount }) },
@@ -792,7 +799,8 @@ export default function MTripShell({
key={seg.value}
type="button"
onClick={() => setListsTab(seg.value)}
- className={`flex items-center gap-[5px] whitespace-nowrap rounded-full px-4 py-2 text-[0.8125rem] ${
+ aria-pressed={listsTab === seg.value}
+ className={`flex flex-none items-center gap-[5px] whitespace-nowrap rounded-full px-4 py-2 text-[0.8125rem] ${
listsTab === seg.value ? 'bg-m-act font-semibold text-m-actfg' : 'font-medium text-m-ink'
}`}
>
@@ -839,13 +847,15 @@ export default function MTripShell({
)}
{trTab === 'dateien' && (
- <div className="absolute inset-x-0 top-1/2 mx-auto flex w-fit -translate-y-1/2 items-center gap-[7px]">
- <PrimaryPill icon={<Upload size={13} strokeWidth={2.2} />} label={t('common.upload')} onClick={() => setUploadFilesSignal(s => s + 1)} />
+ <HeaderActions
+ phone={ROW_CENTRED}
+ primary={<PrimaryPill icon={<Upload size={13} strokeWidth={2.2} />} label={t('common.upload')} onClick={() => setUploadFilesSignal(s => s + 1)} />}
+ >
<DocSyncButton tripId={tripId} trip={trip} label={t('docsync.title')} onOpen={() => setOpenDocSyncSignal(s => s + 1)} />
<MIconBtn ariaLabel={t('files.trash')} onClick={() => setOpenFilesTrashSignal(s => s + 1)} size={40} className="text-m-muted backdrop-blur-[24px] backdrop-saturate-[1.7]">
<Trash2 size={15} strokeWidth={2} />
</MIconBtn>
- </div>
+ </HeaderActions>
)}
{/* A plugin tab is the only one that used to arrive without a name: it is
@@ -934,17 +944,3 @@ export default function MTripShell({
</div>
)
}
-
-/** Primary header action (Add transport / New reservation / Add expense / Upload). */
-function PrimaryPill({ label, onClick, icon }: { label: string; onClick: () => void; icon?: ReactNode }) {
- return (
- <button
- type="button"
- onClick={onClick}
- className="flex h-10 items-center gap-1.5 whitespace-nowrap rounded-full bg-m-act px-[18px] text-[0.8125rem] font-semibold text-m-actfg shadow-[0_10px_24px_-10px_rgba(0,0,0,.45)]"
- >
- {icon ?? <Plus size={14} strokeWidth={2.2} />}
- {label}
- </button>
- )
-}
diff --git a/client/src/mobile/screens/trip/MTripShellParts.tsx b/client/src/mobile/screens/trip/MTripShellParts.tsx
index f566cc2dc..626edf02b 100644
--- a/client/src/mobile/screens/trip/MTripShellParts.tsx
+++ b/client/src/mobile/screens/trip/MTripShellParts.tsx
@@ -1,24 +1,178 @@
-import { FolderSync, List, Rows3 } from 'lucide-react';
-import type { ReactNode } from 'react';
+import { ChevronLeft, ChevronRight, FolderSync, List, Plus, Rows3 } from 'lucide-react';
+import { useLayoutEffect, useState, type ReactNode } from 'react';
import { canManageDocSync } from '../../../components/Files/docsync/useDocSync';
import { useDocSyncOffered } from '../../../components/Files/docsync/useDocSyncOffered';
+import { useIsWide } from '../../../hooks/sizeClass';
import { useAuthStore } from '../../../store/authStore';
import type { Trip } from '../../../types';
import MIconBtn from '../../components/MIconBtn';
+import { edgeFadeClass, useEdgeFade, type EdgeFade } from '../../components/useEdgeFade';
import type { MTripCollabTab } from './MTripShell';
import { collabBoardFor, collabSideBySide } from './tabs/collabPanes';
// The small pieces of the trip screen's top controls (MTripShell).
-/** Centre glass pill of the top controls (segments for plan/lists/collab). */
-export function GlassSegment({ children }: { children: ReactNode }) {
+/**
+ * Centre glass pill of the top controls (segments for plan/lists/collab).
+ *
+ * It has the room between the back button and the trailing button, and never
+ * more: centred there while it fits, its segments drawn a little tighter where
+ * that is enough (a long German or Russian label, a narrow Split View), and
+ * scrolling sideways with faded edges where even that is too wide. It used to
+ * be centred over the whole bar at its full width, and in a narrow window it
+ * covered the back button, the only way out of the trip. `activeKey` names the
+ * segment that is on, which a scrolling control keeps in view.
+ */
+export function GlassSegment({ children, activeKey }: { children: ReactNode; activeKey?: string }) {
+ const [region, setRegion] = useState<HTMLDivElement | null>(null);
+ const [track, setTrack] = useState<HTMLDivElement | null>(null);
+ const fade = useEdgeFade(track);
+ useLayoutEffect(() => {
+ if (!region || !track) return;
+ const fit = () => {
+ track.dataset.tight = 'false';
+ track.dataset.tight = track.scrollWidth > track.clientWidth + 0.5 ? 'true' : 'false';
+ const active = track.querySelector<HTMLElement>('[aria-pressed="true"]');
+ if (active && track.scrollWidth > track.clientWidth + 0.5) {
+ // 'nearest' on both axes: the shell root is fixed, anything else scrolls the page behind it.
+ active.scrollIntoView({ block: 'nearest', inline: 'nearest' });
+ }
+ };
+ fit();
+ const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(fit);
+ observer?.observe(region);
+ return () => observer?.disconnect();
+ }, [region, track, activeKey]);
return (
- <div className="absolute inset-x-0 top-1/2 mx-auto flex w-fit -translate-y-1/2 rounded-full border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] p-[3px] backdrop-blur-[24px] backdrop-saturate-[1.7]">
- {children}
+ <div
+ ref={setRegion}
+ className="pointer-events-none absolute inset-y-0 end-12 start-12 flex items-center justify-center"
+ >
+ <div className="pointer-events-auto flex min-w-0 max-w-full rounded-full border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] p-[3px] backdrop-blur-[24px] backdrop-saturate-[1.7]">
+ <div ref={setTrack} className={`m-seg flex min-w-0 overflow-x-auto rounded-full ${edgeFadeClass(fade)}`}>
+ {children}
+ </div>
+ </div>
</div>
);
}
+/** A phone's header group: after the back button (transports, bookings), or centred on the bar (costs, files). */
+export const ROW_AFTER_BACK = 'absolute start-[52px] end-2 justify-center';
+export const ROW_CENTRED = 'absolute inset-x-0 mx-auto w-fit';
+
+/** Primary header action (Add transport / New reservation / Add expense / Upload). */
+export function PrimaryPill({ label, onClick, icon }: { label: string; onClick: () => void; icon?: ReactNode }) {
+ return (
+ <button
+ type="button"
+ onClick={onClick}
+ className="flex h-10 items-center gap-1.5 whitespace-nowrap rounded-full bg-m-act px-[18px] text-[length:calc(13px*var(--fs-scale-body,1))] font-semibold text-m-actfg shadow-[0_10px_24px_-10px_rgba(0,0,0,.45)]"
+ >
+ {icon ?? <Plus size={14} strokeWidth={2.2} />}
+ {label}
+ </button>
+ );
+}
+
+/**
+ * The primary action of a list tab's top controls (add a transport, a
+ * booking, an expense, upload a file) and the round buttons that go with it.
+ *
+ * On a wide window every tab lays them out alike: the pill in the middle of
+ * the bar, the round buttons at its trailing end where the plan tab keeps its
+ * map switch, so moving between the tabs moves neither. Where the buttons
+ * need more than their half of the bar, the pill steps aside rather than over
+ * them. On a phone the group stays together as it always has: `phone` is that
+ * row's own placement.
+ */
+export function HeaderActions({
+ primary,
+ phone,
+ children,
+}: {
+ primary: ReactNode;
+ phone: string;
+ children: ReactNode;
+}) {
+ const wide = useIsWide();
+ if (!wide) {
+ return (
+ <div className={`${phone} top-1/2 flex -translate-y-1/2 items-center gap-[7px]`}>
+ {primary}
+ {children}
+ </div>
+ );
+ }
+ return (
+ <div className="pointer-events-none absolute inset-0 grid grid-cols-[minmax(48px,1fr)_auto_minmax(max-content,1fr)] items-center gap-x-[10px]">
+ <div className="pointer-events-auto col-start-2 flex min-w-0">{primary}</div>
+ <div className="pointer-events-auto col-start-3 flex items-center gap-[7px] justify-self-end">{children}</div>
+ </div>
+ );
+}
+
+/**
+ * The day strip's way on past an edge, on a wide window: a round chevron over
+ * the faded end that pages the strip along. The fade alone was too quiet on a
+ * large screen, where a day cut in half at the end ("Wed") read as a mistake
+ * rather than as more to come. The days themselves stay where a screen reader
+ * and the keyboard reach them, so the chevron is for the eye and the finger only.
+ */
+export function DayRailSteps({ rail, fade }: { rail: HTMLElement | null; fade: EdgeFade }) {
+ const wide = useIsWide();
+ if (!wide || !rail) return null;
+ // A page along: the day the edge cuts comes to the other edge, whole, so the
+ // next tap continues from there. Read in reading order, so a right-to-left
+ // strip pages the same way round.
+ const step = (toward: 'start' | 'end') => {
+ const rtl = getComputedStyle(rail).direction === 'rtl';
+ const box = rail.getBoundingClientRect();
+ const chips = Array.from(rail.querySelectorAll<HTMLElement>('button'));
+ const pastEnd = (r: DOMRect) => (rtl ? r.left < box.left - 1 : r.right > box.right + 1);
+ const pastStart = (r: DOMRect) => (rtl ? r.right > box.right + 1 : r.left < box.left - 1);
+ const target =
+ toward === 'end'
+ ? chips.find((chip) => pastEnd(chip.getBoundingClientRect()))
+ : chips.filter((chip) => pastStart(chip.getBoundingClientRect())).pop();
+ const reduced = window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches;
+ // 'nearest' on the block axis: the shell root is fixed, anything else scrolls the page behind it.
+ target?.scrollIntoView({
+ inline: toward === 'end' ? 'start' : 'end',
+ block: 'nearest',
+ behavior: reduced ? 'auto' : 'smooth',
+ });
+ };
+ const btn =
+ 'absolute top-1/2 z-[1] flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-full border border-[color:var(--m-gbr)] bg-[color:var(--m-sheetop)] text-m-ink shadow-[0_4px_12px_-4px_rgba(0,0,0,.35)]';
+ return (
+ <>
+ {fade.start && (
+ <button
+ type="button"
+ tabIndex={-1}
+ aria-hidden="true"
+ onClick={() => step('start')}
+ className={`${btn} start-[4px]`}
+ >
+ <ChevronLeft size={15} strokeWidth={2.4} className="rtl:-scale-x-100" />
+ </button>
+ )}
+ {fade.end && (
+ <button
+ type="button"
+ tabIndex={-1}
+ aria-hidden="true"
+ onClick={() => step('end')}
+ className={`${btn} end-[4px]`}
+ >
+ <ChevronRight size={15} strokeWidth={2.4} className="rtl:-scale-x-100" />
+ </button>
+ )}
+ </>
+ );
+}
+
interface CollabSegmentProps {
active: MTripCollabTab;
onPick: (tab: MTripCollabTab) => void;
@@ -42,14 +196,14 @@ export function CollabSegment({ active, onPick, features, split, t }: CollabSegm
{ value: 'polls' as const, label: t('collab.tabs.polls') },
].filter((seg) => !sideBySide || seg.value !== 'chat');
const pill = (
- <GlassSegment>
+ <GlassSegment activeKey={`${current}:${segments.map((seg) => seg.label).join('|')}`}>
{segments.map((seg) => (
<button
key={seg.value}
type="button"
onClick={() => onPick(seg.value)}
aria-pressed={current === seg.value}
- className={`whitespace-nowrap rounded-full px-4 py-2 text-[length:calc(13px*var(--fs-scale-body,1))] ${
+ className={`flex-none whitespace-nowrap rounded-full px-4 py-2 text-[length:calc(13px*var(--fs-scale-body,1))] ${
current === seg.value ? 'bg-m-act font-semibold text-m-actfg' : 'font-medium text-m-ink'
}`}
>
diff --git a/client/src/mobile/screens/trip/map/MMapArea.tsx b/client/src/mobile/screens/trip/map/MMapArea.tsx
index c18b10ecc..3e9f9fdd2 100644
--- a/client/src/mobile/screens/trip/map/MMapArea.tsx
+++ b/client/src/mobile/screens/trip/map/MMapArea.tsx
@@ -10,6 +10,10 @@ import { useMergedMapPois } from '../../../../components/Map/useMergedMapPois'
import { firstStopOfPlace, stageOf } from '../../../../components/Roadtrip/roadtripRowModel'
import { stageMapData } from '../../../../components/Roadtrip/stageMap'
import { usePlanMapViewport } from '../../../../hooks/usePlanMapViewport'
+import { useIsDark } from '../../../../hooks/useIsDark'
+import { useTileUrl } from '../../../../hooks/useTileUrl'
+import { useIsWide } from '../../../../hooks/sizeClass'
+import { OFM_DARK } from '../../../../constants/mapDefaults'
import { useRoadtripSettings } from '../../../../hooks/useRoadtripSettings'
import { useSettingsStore } from '../../../../store/settingsStore'
import { useTripStore } from '../../../../store/tripStore'
@@ -174,6 +178,14 @@ export default function MMapArea({ planner, shell }: MMapAreaProps) {
}, [poiViewportChange, reportViewport])
const [glMap, setGlMap] = useState<CompassMap | null>(null)
const poiPillEnabled = useSettingsStore(s => s.settings.map_poi_pill_enabled) !== false
+ // On a wide window the map stands beside the pane and under the rail, a third
+ // or more of the screen, so in the dark theme it takes the dark basemap the
+ // journey and the atlas use rather than a bright patch beside a black pane.
+ // A basemap of the user's own choosing stays (useTileUrl prefers it).
+ const darkTileUrl = useTileUrl(OFM_DARK)
+ const wide = useIsWide()
+ const dark = useIsDark()
+ const tileUrl = wide && dark ? darkTileUrl : planner.mapTileUrl
const distanceUnit = useSettingsStore(s => s.settings.distance_unit)
const dayColorsOn = useRoadtripSettings(s => s.roadtrip_day_colors, planner.tripId)
@@ -389,7 +401,7 @@ export default function MMapArea({ planner, shell }: MMapAreaProps) {
// nothing, which keeps its pool behaviour (#1998).
onMapContextMenu={e => planner.handleMapContextMenu(e, planner.selectedDayId)}
// No center/zoom: the map frames itself on the trip's places at mount.
- tileUrl={planner.mapTileUrl}
+ tileUrl={tileUrl}
fitKey={planner.fitKey}
dayOrderMap={planner.dayOrderMap}
reservations={planner.reservations}
diff --git a/client/src/mobile/screens/trip/places/MPlacesBrowser.tsx b/client/src/mobile/screens/trip/places/MPlacesBrowser.tsx
index 3b34d16ac..b91441b15 100644
--- a/client/src/mobile/screens/trip/places/MPlacesBrowser.tsx
+++ b/client/src/mobile/screens/trip/places/MPlacesBrowser.tsx
@@ -4,6 +4,7 @@ import {
SlidersHorizontal, Tag, Trash2, X,
} from 'lucide-react'
import MDancingTrek from '../../../components/MDancingTrek'
+import MChipStrip from '../../../components/MChipStrip'
import { useAddonStore } from '../../../../store/addonStore'
import PlaceAvatar from '../../../../components/shared/PlaceAvatar'
import MarkdownText from '../../../../components/shared/MarkdownText'
@@ -116,24 +117,31 @@ export default function MPlacesBrowser({ planner, shell }: MPlacesBrowserProps)
return (
<div className="flex h-full flex-col">
<div className="min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-4 pb-[calc(var(--bottom-nav-h,84px)+22px)] pt-[calc(var(--m-safe-top,12px)+58px)]">
+ {/* ── Places/Tours, the filter chips and Import (Add sits in the search row
+ below to free space). The switch has a row of its own, except where the
+ screen is short (a phone on its side): there it shares the chips' row,
+ so the list is not left one place tall under the controls. The chips
+ share their row while their names fit, and scroll with a faded edge
+ where a long name does not (Russian "Незапланированные"). ── */}
+ <div className="flex flex-wrap items-center gap-x-[6px] gap-y-3">
{toursEnabled && (
- <MPlacesToursModeSwitch active={toursMode} onChange={setToursMode} />
+ <MPlacesToursModeSwitch
+ active={toursMode}
+ onChange={setToursMode}
+ className="basis-full [@media(max-height:500px)]:flex-none [@media(max-height:500px)]:basis-auto"
+ />
)}
{toursEnabled && toursMode ? (
- <>
- {/* All / Unplanned / Planned only — no Tracks chip, no Import/Add/Select
- buttons: tours are attached here, never created or bulk-managed. */}
- <div className="flex items-center gap-[6px]">
- <FilterChip active={tourFilters.status === 'all'} label={t('places.all')} onClick={() => tourFilters.setStatus('all')} />
- <FilterChip active={tourFilters.status === 'unplanned'} label={t('places.unplanned')} onClick={() => tourFilters.setStatus('unplanned')} />
- <FilterChip active={tourFilters.status === 'planned'} label={t('places.planned')} onClick={() => tourFilters.setStatus('planned')} />
- </div>
- <MToursSelectionList planner={planner} shell={shell} filters={tourFilters} />
- </>
+ // All / Unplanned / Planned only — no Tracks chip, no Import/Add/Select
+ // buttons: tours are attached here, never created or bulk-managed.
+ <MChipStrip className="flex-1 items-center gap-[6px]">
+ <FilterChip active={tourFilters.status === 'all'} label={t('places.all')} onClick={() => tourFilters.setStatus('all')} />
+ <FilterChip active={tourFilters.status === 'unplanned'} label={t('places.unplanned')} onClick={() => tourFilters.setStatus('unplanned')} />
+ <FilterChip active={tourFilters.status === 'planned'} label={t('places.planned')} onClick={() => tourFilters.setStatus('planned')} />
+ </MChipStrip>
) : (
<>
- {/* ── Filter chips + Import (Add sits in the search row below to free space) ── */}
- <div className="flex items-center gap-[6px]">
+ <MChipStrip className="flex-1 items-center gap-[6px]">
<FilterChip
active={filter === 'all'}
label={t('places.all')}
@@ -156,6 +164,7 @@ export default function MPlacesBrowser({ planner, shell }: MPlacesBrowserProps)
onClick={() => pickFilter('tracks')}
/>
)}
+ </MChipStrip>
{canEditPlaces && (
<button
type="button"
@@ -166,7 +175,13 @@ export default function MPlacesBrowser({ planner, shell }: MPlacesBrowserProps)
<Download size={16} strokeWidth={2} />
</button>
)}
+ </>
+ )}
</div>
+ {toursEnabled && toursMode ? (
+ <MToursSelectionList planner={planner} shell={shell} filters={tourFilters} />
+ ) : (
+ <>
{/* ── Search + category filter + select toggle ── */}
<div className="mt-[10px] flex items-stretch gap-2">
@@ -401,13 +416,15 @@ export default function MPlacesBrowser({ planner, shell }: MPlacesBrowserProps)
}
/** All / Unplanned / Planned / Tracks pool chip. Counts are omitted on mobile to save row
- * space; chips flex to share the row's full width up to the import button on the right. */
+ * space; chips flex to share the row's full width up to the import button at its end. */
function FilterChip({ active, label, onClick }: { active: boolean; label: string; onClick: () => void }) {
return (
<button
type="button"
onClick={onClick}
- className={`flex h-10 min-w-0 flex-1 items-center justify-center whitespace-nowrap rounded-full px-[12px] text-[0.75rem] font-semibold ${
+ aria-pressed={active}
+ // Shares the row equally while every name fits, and is never narrower than its own name.
+ className={`flex h-10 min-w-max flex-1 items-center justify-center whitespace-nowrap rounded-full px-[12px] text-[0.75rem] font-semibold ${
active ? 'bg-m-act text-m-actfg' : 'bg-[color:var(--m-ic)] text-m-ink'
}`}
>
diff --git a/client/src/mobile/screens/trip/places/MPlacesToursModeSwitch.tsx b/client/src/mobile/screens/trip/places/MPlacesToursModeSwitch.tsx
index f5ea793ba..90dbb5b93 100644
--- a/client/src/mobile/screens/trip/places/MPlacesToursModeSwitch.tsx
+++ b/client/src/mobile/screens/trip/places/MPlacesToursModeSwitch.tsx
@@ -4,11 +4,13 @@ import { useTranslation } from '../../../../i18n/TranslationContext'
interface MPlacesToursModeSwitchProps {
active: boolean
onChange: (tours: boolean) => void
+ /** Its place in the row it sits in; by default a row of its own above the filters. */
+ className?: string
}
/** Mobile counterpart of PlacesToursModeSwitch: top-level "Places <-> Tours"
* switch of the places browser, with m-token styling to match the browser chrome. */
-export default function MPlacesToursModeSwitch({ active, onChange }: MPlacesToursModeSwitchProps) {
+export default function MPlacesToursModeSwitch({ active, onChange, className = 'mb-3' }: MPlacesToursModeSwitchProps) {
const { t } = useTranslation()
const options: [boolean, string, typeof MapPin][] = [
[false, t('tours.mode.places'), MapPin],
@@ -18,7 +20,7 @@ export default function MPlacesToursModeSwitch({ active, onChange }: MPlacesTour
<div
role="tablist"
aria-label={t('tours.mode.label')}
- className="mb-3 flex gap-1 rounded-[12px] border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] p-1"
+ className={`flex gap-1 rounded-[12px] border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] p-1 ${className}`}
>
{options.map(([value, label, Icon]) => {
const selected = active === value
diff --git a/client/src/mobile/screens/trip/plan/MPlanTimeline.tsx b/client/src/mobile/screens/trip/plan/MPlanTimeline.tsx
index 3a94e1298..8ee8c4d0b 100644
--- a/client/src/mobile/screens/trip/plan/MPlanTimeline.tsx
+++ b/client/src/mobile/screens/trip/plan/MPlanTimeline.tsx
@@ -27,6 +27,7 @@ import { useSettingsStore } from '../../../../store/settingsStore'
import MRouteAppsSheet from './MRouteAppsSheet'
import { openRouteTarget } from './openRouteTarget'
import MDayPager from '../../../components/MDayPager'
+import { edgeFadeClass, useEdgeFade } from '../../../components/useEdgeFade'
import { useDayPreviewStore } from '../../../dayPreviewStore'
/**
@@ -188,6 +189,8 @@ function PlanDayPage({ planner, shell, dayId: pageDayId, active, editing, legMen
}
const chrome = { editing, t, language: tl.language, timeFormat: tl.timeFormat }
+ const [cardScroll, setCardScroll] = useState<HTMLDivElement | null>(null)
+ const cardFade = useEdgeFade(cardScroll, 'y')
// One Maps button for every app the day can be opened in: the preferred app
// from settings (#2423) opens straight away, otherwise the sheet asks.
@@ -205,15 +208,22 @@ function PlanDayPage({ planner, shell, dayId: pageDayId, active, editing, legMen
{/* One column under the day chips: the UP-NEXT card (go mode) or the edit
header, then the timeline card filling the rest, 12px apart whatever height
the card above it has. A day without an up-next starts the timeline right
- under the chips. */}
- <div className="absolute inset-x-4 flex flex-col gap-3 top-[calc(var(--m-safe-top,12px)+102px)] bottom-[calc(env(safe-area-inset-bottom,0px)+90px)]">
+ under the chips. On a wide window the column ends where the rail does.
+ Beside the map the card is the pane and runs down to that line, as the
+ places list does; across the page it is as tall as its day, so a short
+ day leaves no empty card under it. */}
+ <div className="absolute inset-x-4 flex flex-col gap-3 top-[calc(var(--m-safe-top,12px)+102px)] bottom-[calc(env(safe-area-inset-bottom,0px)+90px)] wide:bottom-[calc(env(safe-area-inset-bottom,0px)+12px)]">
{!editing && <UpNextCard tl={tl} t={t} onOpen={openPlace} />}
{editing && <EditHeader tl={tl} planner={planner} shell={shell} />}
+ {/* The frame and the scroller are two boxes, so the fade where a row runs on
+ past the card's edge takes the rows and leaves the card's own edge whole. */}
+ <div className="flex min-h-0 flex-1 flex-col overflow-hidden rounded-[22px] border border-[color:var(--m-cbr)] bg-[color:var(--m-card)] backdrop-blur-[24px] backdrop-saturate-[1.6] wide:flex-initial split:flex-1">
<div
+ ref={setCardScroll}
data-touch-drag={editing && active ? '' : undefined}
data-timeline-card=""
- className="min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain rounded-[22px] border border-[color:var(--m-cbr)] bg-[color:var(--m-card)] px-3.5 pb-2 pt-1 backdrop-blur-[24px] backdrop-saturate-[1.6]"
+ className={`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-y-contain px-3.5 pb-2 pt-1 ${edgeFadeClass(cardFade, 'y')}`}
>
{planner.toursEnabled && tl.rows.some(row => row.kind === 'place' && row.invalidTour) && (
<div role="status" className="border-b border-[color:var(--warning)] p-2 text-sm text-[color:var(--warning)]">
@@ -346,6 +356,7 @@ function PlanDayPage({ planner, shell, dayId: pageDayId, active, editing, legMen
</div>
)}
</div>
+ </div>
</div>
</>
)
@@ -521,17 +532,20 @@ function TimelineHeader({ tl, dayLabel, openLabel, weatherLabel, onOpenDay, onOp
</>
)}
</button>
+ {/* A stay gives way before anything else in the header does: its name ends
+ in an ellipsis rather than under the edge or the weather (the chip's
+ label says it whole), and the time after it stays. */}
{tl.hotelChips.map(chip => (
<button
key={chip.key}
type="button"
onClick={() => onOpenStay(chip)}
aria-label={stayLabel(chip)}
- className={`${GLASS_CHIP} gap-[5px] px-2.5`}
+ className={`${GLASS_CHIP} min-w-[4.5rem] shrink gap-[5px] px-2.5`}
>
<HotelChipIcon variant={chip.variant} />
- {chip.name}
- {chip.time ? ` · ${chip.time.slice(0, 5)}` : ''}
+ <span className="min-w-0 truncate">{chip.name}</span>
+ {chip.time && <span className="flex-none tabular-nums text-m-muted">{chip.time.slice(0, 5)}</span>}
</button>
))}
</span>
diff --git a/client/src/mobile/screens/trip/tabs/MBookingsTab.tsx b/client/src/mobile/screens/trip/tabs/MBookingsTab.tsx
index 8c53e39a5..f00763393 100644
--- a/client/src/mobile/screens/trip/tabs/MBookingsTab.tsx
+++ b/client/src/mobile/screens/trip/tabs/MBookingsTab.tsx
@@ -7,7 +7,7 @@ import type { Reservation } from '../../../../types'
import { CardActions, CardDeleteSheet, CardFiles, CardNotes, CardTitleButton, CardWhenAndCode } from './MReservationCardParts'
import { CardGrid, Field, ReservationPluginSlots, SectionHeader, StatusDot, TabScroller, TravelerAvatars, TravelerFilterRow } from './tabChrome'
import { STATUS_COLOR, type MTabScreenProps } from './tabModel'
-import { cardWhen, parseTransportMeta } from './transportsModel'
+import { cardWhen, parseTransportMeta, timeRange } from './transportsModel'
import { BOOKING_TYPE_COLOR } from '../../../../components/Planner/bookings/bookingsModel'
import { useReservationListFilter } from '../../../../components/Planner/bookings/useReservationListFilter'
import { useReservationCard } from '../../../../components/Planner/bookings/useReservationCard'
@@ -119,7 +119,7 @@ function BookingCard({ res, planner, canEdit, compact }: {
if (meta.check_in_time) {
metaCells.push({
label: t('reservations.meta.checkIn'),
- value: formatTime(meta.check_in_time, locale, timeFormat) + (meta.check_in_end_time ? ` – ${formatTime(meta.check_in_end_time, locale, timeFormat)}` : ''),
+ value: timeRange(meta.check_in_time, meta.check_in_end_time ?? null, locale, timeFormat),
})
}
if (meta.check_out_time) metaCells.push({ label: t('reservations.meta.checkOut'), value: formatTime(meta.check_out_time, locale, timeFormat) })
diff --git a/client/src/mobile/screens/trip/tabs/MCollabChat.tsx b/client/src/mobile/screens/trip/tabs/MCollabChat.tsx
index fe243d3f2..17786fe9a 100644
--- a/client/src/mobile/screens/trip/tabs/MCollabChat.tsx
+++ b/client/src/mobile/screens/trip/tabs/MCollabChat.tsx
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'
import { createPortal } from 'react-dom'
import { ArrowUp, ChevronUp, ImagePlus, Loader2, Reply, Trash2 } from 'lucide-react'
import MDancingTrek from '../../../components/MDancingTrek'
+import { edgeFadeClass, useEdgeFade } from '../../../components/useEdgeFade'
import CollabAssistantBadge from '../../../../components/Collab/CollabAssistantBadge'
import { useCollabChatData } from '../../../../components/Collab/useCollabChatData'
import { useAuthStore } from '../../../../store/authStore'
@@ -58,6 +59,8 @@ export default function MCollabChat({ planner }: MCollabChatProps) {
deleteMessage, reactToMessage,
} = useCollabChatData({ tripId, t, toast, toastLoadMoreErrors: true, canSend: canEdit })
const [popover, setPopover] = useState<{ msg: ChatMessage; x: number; y: number } | null>(null)
+ const [list, setList] = useState<HTMLDivElement | null>(null)
+ const listFade = useEdgeFade(list, 'y')
const imageInputRef = useRef<HTMLInputElement>(null)
const handleDelete = useCallback(async (msgId: number) => {
@@ -88,7 +91,14 @@ export default function MCollabChat({ planner }: MCollabChatProps) {
<p className="font-geist text-[0.8125rem] font-medium text-m-muted">{t('collab.chat.empty')}</p>
</div>
) : (
- <div ref={scrollRef} onScroll={checkAtBottom} className="mt-3 min-h-0 flex-1 overflow-y-auto">
+ // The list ends under the floating controls, and a message scrolled past that
+ // edge fades out there instead of being cut through a line of its text or
+ // left as a sliver of a bubble under the controls.
+ <div
+ ref={el => { scrollRef.current = el; setList(el) }}
+ onScroll={checkAtBottom}
+ className={`mt-3 min-h-0 flex-1 overflow-y-auto [--m-fade-reach-y:32px] ${edgeFadeClass(listFade, 'y')}`}
+ >
{hasMore && (
<div className="flex justify-center pb-[10px]">
<button
diff --git a/client/src/mobile/screens/trip/tabs/MCollabNotes.tsx b/client/src/mobile/screens/trip/tabs/MCollabNotes.tsx
index 10707a6ad..9f8026b96 100644
--- a/client/src/mobile/screens/trip/tabs/MCollabNotes.tsx
+++ b/client/src/mobile/screens/trip/tabs/MCollabNotes.tsx
@@ -5,6 +5,7 @@ import remarkBreaks from 'remark-breaks'
import { sanitizedMarkdownPlugins, sanitizedMarkdownComponents } from '../../../../components/shared/markdownSanitize'
import { Check, ExternalLink, FileText, Paperclip, Pin, PinOff, Plus, StickyNote, Trash2, X } from 'lucide-react'
import MDancingTrek from '../../../components/MDancingTrek'
+import MChipStrip from '../../../components/MChipStrip'
import { collabApi } from '../../../../api/client'
import { announceNoteFilesChanged, useCollabNotesData } from '../../../../components/Collab/useCollabNotesData'
import { openFile } from '../../../../utils/fileDownload'
@@ -153,9 +154,11 @@ export default function MCollabNotes({ planner }: MCollabNotesProps) {
return (
<TabScroller wide="full">
+ {/* The categories scroll within their own room and fade at its edges; New
+ Note stays outside that room, so it never lies over a category. */}
<div className="flex items-center justify-between gap-2">
{categories.length > 0 ? (
- <div className="flex flex-1 gap-[6px] overflow-x-auto">
+ <MChipStrip className="flex-1 gap-[6px]">
<button
type="button"
onClick={() => setActiveCategory(null)}
@@ -180,7 +183,7 @@ export default function MCollabNotes({ planner }: MCollabNotesProps) {
</button>
)
})}
- </div>
+ </MChipStrip>
) : (
<span />
)}
diff --git a/client/src/mobile/screens/trip/tabs/MCollabPolls.tsx b/client/src/mobile/screens/trip/tabs/MCollabPolls.tsx
index c6e32ff6c..cbbf19852 100644
--- a/client/src/mobile/screens/trip/tabs/MCollabPolls.tsx
+++ b/client/src/mobile/screens/trip/tabs/MCollabPolls.tsx
@@ -251,11 +251,14 @@ function PollCardRow({ poll, canEdit, currentUserId, t, onVote, onClosePoll, onD
const pct = total > 0 ? Math.round((count / total) * 100) : 0
const myVote = currentUserId != null && (opt.voters || []).some(v => String(v.user_id) === String(currentUserId))
const isWinner = closed && count > 0 && count === maxCount
+ // The share is a fill that differs from both the row's empty rest and the
+ // card around it. At 6% ink it matched the card, so an option at 67% read
+ // as a short white block at its end, the rest of the row.
const fillTint = myVote
- ? 'color-mix(in srgb, var(--m-act) 16%, transparent)'
+ ? 'color-mix(in srgb, var(--m-act) 20%, transparent)'
: isWinner
- ? 'color-mix(in srgb, var(--m-st-confirmed) 16%, transparent)'
- : 'color-mix(in srgb, var(--m-ink) 6%, transparent)'
+ ? 'color-mix(in srgb, var(--m-st-confirmed) 22%, transparent)'
+ : 'color-mix(in srgb, var(--m-ink) 13%, transparent)'
return (
<button
@@ -263,14 +266,14 @@ function PollCardRow({ poll, canEdit, currentUserId, t, onVote, onClosePoll, onD
type="button"
disabled={closed || !canEdit}
onClick={() => onVote(poll.id, idx)}
- className="relative flex items-start gap-[8px] overflow-hidden rounded-[10px] bg-m-card px-[12px] py-[10px] text-start disabled:cursor-default"
+ className="relative flex items-start gap-[8px] overflow-hidden rounded-[10px] border border-[color:var(--m-trackoff)] bg-m-card px-[12px] py-[10px] text-start disabled:cursor-default"
>
<span className="absolute inset-y-0 start-0" style={{ width: `${pct}%`, background: fillTint }} />
<span
className={`relative flex h-5 w-5 flex-none items-center justify-center border-2 ${
poll.multiple_choice ? 'rounded-[6px]' : 'rounded-full'
}`}
- style={{ borderColor: myVote ? 'var(--m-act)' : 'var(--m-rowbr)', background: myVote ? 'var(--m-act)' : 'transparent' }}
+ style={{ borderColor: myVote ? 'var(--m-act)' : 'var(--m-checkbr)', background: myVote ? 'var(--m-act)' : 'transparent' }}
>
{myVote && <Check size={11} strokeWidth={3} className="text-m-actfg" />}
</span>
diff --git a/client/src/mobile/screens/trip/tabs/MCostsTab.tsx b/client/src/mobile/screens/trip/tabs/MCostsTab.tsx
index 29db6f6c2..bc0baecc1 100644
--- a/client/src/mobile/screens/trip/tabs/MCostsTab.tsx
+++ b/client/src/mobile/screens/trip/tabs/MCostsTab.tsx
@@ -137,31 +137,40 @@ export default function MCostsTab({ planner, shell }: MTabScreenProps) {
<div className="mt-1 font-geist text-[1.875rem] font-extrabold tabular-nums tracking-[-0.02em]">
{formatMoney(totals.totalSpend, base, locale)}
</div>
- <div className="mt-[6px] flex flex-wrap gap-[14px] text-[0.6875rem]" style={{ color: 'rgba(245,245,247,.7)' }}>
- <span>{t('costs.yourShare')} · <b style={{ color: '#F5F5F7' }}>{formatMoney(totals.myShare, base, locale)}</b></span>
- <span>{t('costs.youPaid')} · <b style={{ color: '#F5F5F7' }}>{formatMoney(totals.myPaid, base, locale)}</b></span>
+ {/* Each figure under its own label, so the two pairs never read as one run. */}
+ <div className="mt-[8px] flex flex-wrap gap-x-[22px] gap-y-[6px] text-[0.6875rem]" style={{ color: 'rgba(245,245,247,.7)' }}>
+ <span className="flex flex-col">
+ {t('costs.yourShare')}
+ <b className="tabular-nums" style={{ color: '#F5F5F7' }}>{formatMoney(totals.myShare, base, locale)}</b>
+ </span>
+ <span className="flex flex-col">
+ {t('costs.youPaid')}
+ <b className="tabular-nums" style={{ color: '#F5F5F7' }}>{formatMoney(totals.myPaid, base, locale)}</b>
+ </span>
</div>
</div>
- {/* You owe / You're owed (spec §3.2) */}
+ {/* You owe / You're owed (spec §3.2). The two tiles stand level and each
+ amount sits at the foot of its tile, so a label that wraps in one of
+ them (German "Dir wird geschuldet") leaves both amounts on one line. */}
<div className="mt-[10px] flex gap-2">
- <div className="flex-1 rounded-2xl border border-[color:var(--m-rowbr)] bg-m-card p-[13px]">
- <span className="flex h-[30px] w-[30px] items-center justify-center rounded-[10px]" style={{ background: 'rgba(214,39,59,.12)', color: STATUS_COLOR.danger }}>
+ <div className="flex flex-1 flex-col rounded-2xl border border-[color:var(--m-rowbr)] bg-m-card p-[13px]">
+ <span className="flex h-[30px] w-[30px] items-center justify-center self-start rounded-[10px]" style={{ background: 'rgba(214,39,59,.12)', color: STATUS_COLOR.danger }}>
<ArrowDown size={15} strokeWidth={2.2} />
</span>
<div className="mt-2 text-[0.8125rem] font-bold text-m-ink">{t('costs.youOwe')}</div>
<div className="font-geist text-[0.59375rem] text-m-faint">{t('costs.youOweSub')}</div>
- <div className="mt-1 font-geist text-[1.1875rem] font-extrabold tabular-nums" style={{ color: totals.owe > 0.5 ? STATUS_COLOR.danger : 'var(--m-ink)' }}>
+ <div className="mt-auto pt-1 font-geist text-[1.1875rem] font-extrabold tabular-nums" style={{ color: totals.owe > 0.5 ? STATUS_COLOR.danger : 'var(--m-ink)' }}>
{formatMoney(totals.owe, base, locale)}
</div>
</div>
- <div className="flex-1 rounded-2xl border border-[color:var(--m-rowbr)] bg-m-card p-[13px]">
- <span className="flex h-[30px] w-[30px] items-center justify-center rounded-[10px]" style={{ background: 'rgba(47,163,122,.12)', color: STATUS_COLOR.confirmed }}>
+ <div className="flex flex-1 flex-col rounded-2xl border border-[color:var(--m-rowbr)] bg-m-card p-[13px]">
+ <span className="flex h-[30px] w-[30px] items-center justify-center self-start rounded-[10px]" style={{ background: 'rgba(47,163,122,.12)', color: STATUS_COLOR.confirmed }}>
<ArrowUp size={15} strokeWidth={2.2} />
</span>
<div className="mt-2 text-[0.8125rem] font-bold text-m-ink">{t('costs.youreOwed')}</div>
<div className="font-geist text-[0.59375rem] text-m-faint">{t('costs.youreOwedSub')}</div>
- <div className="mt-1 font-geist text-[1.1875rem] font-extrabold tabular-nums" style={{ color: totals.owed > 0.5 ? STATUS_COLOR.confirmed : 'var(--m-ink)' }}>
+ <div className="mt-auto pt-1 font-geist text-[1.1875rem] font-extrabold tabular-nums" style={{ color: totals.owed > 0.5 ? STATUS_COLOR.confirmed : 'var(--m-ink)' }}>
{formatMoney(totals.owed, base, locale)}
</div>
</div>
@@ -186,15 +195,18 @@ export default function MCostsTab({ planner, shell }: MTabScreenProps) {
{/* Settle up (spec §3.4) */}
<div className="mt-2 rounded-2xl border border-[color:var(--m-rowbr)] bg-m-card p-[13px]">
{/* Toggle and "Add payment" are siblings, not nested: a control inside a
- control reads as one element to a screen reader. */}
- <div className="flex w-full items-center gap-[7px]">
+ control reads as one element to a screen reader. Where the title, the
+ count, the chevron and the button do not fit on one line (a long
+ language in a narrow pane), the button moves to a line of its own
+ under them instead of lying over the count and the chevron. */}
+ <div className="flex w-full flex-wrap items-center gap-x-[10px] gap-y-2">
<button
type="button"
aria-expanded={settleOpen}
onClick={() => setSettleOpen(v => !v)}
- className="flex min-w-0 flex-1 items-center gap-[7px] text-start"
+ className="flex min-w-0 flex-[1_1_auto] items-center gap-[7px] text-start"
>
- <span className="text-[0.875rem] font-extrabold text-m-ink">{t('costs.settleUp')}</span>
+ <span className="min-w-0 text-[0.875rem] font-extrabold text-m-ink">{t('costs.settleUp')}</span>
<CountPill>{flows.length}</CountPill>
{settleOpen ? (
<ChevronUp size={14} strokeWidth={2} className="ms-auto flex-none text-m-faint" />
@@ -206,7 +218,7 @@ export default function MCostsTab({ planner, shell }: MTabScreenProps) {
<button
type="button"
onClick={() => setAddPaymentOpen(true)}
- className="flex flex-none items-center gap-[5px] rounded-full border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] px-[11px] py-[6px] font-[inherit] text-[0.71875rem] font-semibold text-m-muted"
+ className="ms-auto flex flex-none items-center gap-[5px] whitespace-nowrap rounded-full border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] px-[11px] py-[6px] font-[inherit] text-[0.71875rem] font-semibold text-m-muted"
>
<Plus size={11} strokeWidth={2.2} />
{t('costs.addPayment')}
@@ -777,7 +789,7 @@ function FinalBudgetBreakdown({ row, items, ctx, base, locale, t, personName }:
const nameOf = (itemId: number, name: string, shown: number) => {
const e = items.find(i => i.id === itemId)
const entered = e ? lineOf(paidByUser(e, row.user_id), e, ctx, shown)?.entered : null
- return entered ? `${name} · ${formatMoney(entered.amount, entered.currency, locale)}` : name
+ return entered ? `${name} (${formatMoney(entered.amount, entered.currency, locale)})` : name
}
const line = (key: string, label: string, value: string) => (
<div key={key} className="flex items-baseline gap-2 py-[2px] font-geist text-[0.6875rem]">
diff --git a/client/src/mobile/screens/trip/tabs/MFilesBoard.tsx b/client/src/mobile/screens/trip/tabs/MFilesBoard.tsx
index 6ec979ebe..6fced702e 100644
--- a/client/src/mobile/screens/trip/tabs/MFilesBoard.tsx
+++ b/client/src/mobile/screens/trip/tabs/MFilesBoard.tsx
@@ -14,6 +14,8 @@ type Planner = MTabScreenProps['planner'];
/** The product's name, the same in every language. */
const APPLE_WALLET = 'Apple Wallet';
const isPdf = (file: TripFile) => file.mime_type === 'application/pdf';
+/** Whether the engine draws a PDF inside the page (a headless or locked-down one says no). */
+const pdfInPage = () => typeof navigator !== 'undefined' && navigator.pdfViewerEnabled === true;
/**
* A file's signed address for showing it in place (a tile's picture, the
@@ -79,7 +81,8 @@ const roundBtn =
interface FileTileProps {
file: TripFile;
- selected: boolean;
+ /** Whether it is the one previewed beside the grid; left out where a tap opens the file instead. */
+ selected?: boolean;
canStar: boolean;
onPick: () => void;
onStar: () => void;
@@ -90,7 +93,9 @@ interface FileTileProps {
/**
* A file as a tile of the grid a wide window shows in place of the phone's
* rows: its picture (a photo's own, the type's colour and icon otherwise),
- * the name under it, size and date as badges.
+ * the name under it, size and date as badges. Beside a preview pane a tap
+ * picks it, and it says whether it is the picked one; without the pane a tap
+ * opens the file, and a toggle state would announce something it is not.
*/
export function FileTile({ file, selected, canStar, onPick, onStar, onMenu, t }: FileTileProps) {
const { locale } = useTranslation();
@@ -180,65 +185,77 @@ interface FilePreviewPaneProps {
* The file picked in the grid, shown beside it once the window has room for
* two panes, the way Files on an iPad previews a document: the picture or the
* document itself, then what it is, what it belongs to, and what to do with it.
+ * A file with nothing to show in place (a PDF where the engine cannot draw one,
+ * a ticket, a pass) gets its type's tile beside its name, rather than a large
+ * coloured box with a small icon that read as a preview that failed to load.
*/
export function FilePreviewPane({ file, planner, onOpen, onStar, onLinks, onMenu }: FilePreviewPaneProps) {
const { t } = planner;
const { locale } = useTranslation();
const meta = getFileTypeMeta(file);
- const showsInPlace = isImage(file.mime_type) || isPdf(file);
- const src = useSignedUrl(file.url, showsInPlace);
+ const image = isImage(file.mime_type);
+ const pdf = isPdf(file) && pdfInPage();
+ const src = useSignedUrl(file.url, image || pdf);
const linked = linkedFileTargets(file, planner.places, planner.reservations, planner.TRANSPORT_TYPES);
const canEdit = planner.can('file_edit', planner.trip);
const starred = !!file.starred;
- const actionBtn =
- 'flex h-10 flex-1 items-center justify-center gap-[6px] rounded-full border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] text-caption font-semibold text-m-ink outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--m-act)]';
+ // One line each, the label clear of the pill's edge; a row too narrow for all of
+ // them moves the last ones to a row of their own rather than folding a label.
+ const roundAction =
+ 'flex h-10 items-center justify-center gap-[6px] whitespace-nowrap rounded-full border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] text-caption font-semibold text-m-ink outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--m-act)]';
+ const actionBtn = `${roundAction} flex-[1_1_auto] px-[14px]`;
+ const shownInPlace = (image || pdf) && !!src;
return (
<div className="flex flex-col gap-3">
- {isImage(file.mime_type) && src ? (
+ {image && src && (
// A photo takes its own proportions, up to the height the pane can spare.
<img
src={src}
alt={file.original_name}
className="block max-h-[60dvh] w-full rounded-2xl border border-[color:var(--m-rowbr)] bg-m-sheetop object-contain"
/>
- ) : (
+ )}
+ {pdf && src && (
<div className="relative aspect-[4/5] max-h-[56dvh] w-full overflow-hidden rounded-2xl border border-[color:var(--m-rowbr)] bg-m-sheetop">
- {isPdf(file) && src ? (
- <object
- data={`${src}#view=FitH`}
- type="application/pdf"
- title={file.original_name}
- className="absolute inset-0 h-full w-full"
- >
- <TypeArt file={file} large />
- </object>
- ) : (
+ <object
+ data={`${src}#view=FitH`}
+ type="application/pdf"
+ title={file.original_name}
+ className="absolute inset-0 h-full w-full"
+ >
<TypeArt file={file} large />
- )}
+ </object>
</div>
)}
- <div>
- <h3 className="break-words text-[length:calc(16px*var(--fs-scale-subtitle,1))] font-extrabold leading-[1.3] text-m-ink">
- <bdi>{file.original_name}</bdi>
- </h3>
- <div className="mt-[6px] flex flex-wrap items-center gap-1">
- <span
- className="rounded-full px-[7px] py-[2px] font-geist text-[length:calc(9px*var(--fs-scale-caption,1))] font-extrabold tracking-[.06em]"
- style={{ background: `${meta.color}1f`, color: meta.color }}
- >
- {meta.label}
+ <div className="flex items-start gap-3">
+ {!shownInPlace && (
+ <span className="relative block h-[92px] w-[74px] flex-none overflow-hidden rounded-xl border border-[color:var(--m-rowbr)] bg-m-sheetop">
+ <TypeArt file={file} />
</span>
- {isWalletPass(file.mime_type, file.original_name) && (
- <span className="flex items-center gap-[3px] rounded-full bg-m-act px-[7px] py-[2px] font-geist text-[length:calc(9px*var(--fs-scale-caption,1))] font-bold text-m-actfg">
- <Wallet size={9} strokeWidth={2.4} aria-hidden="true" />
- {APPLE_WALLET}
+ )}
+ <div className={`min-w-0 flex-1 ${shownInPlace ? '' : 'pt-1'}`}>
+ <h3 className="break-words text-[length:calc(16px*var(--fs-scale-subtitle,1))] font-extrabold leading-[1.3] text-m-ink">
+ <bdi>{file.original_name}</bdi>
+ </h3>
+ <div className="mt-[6px] flex flex-wrap items-center gap-1">
+ <span
+ className="rounded-full px-[7px] py-[2px] font-geist text-[length:calc(9px*var(--fs-scale-caption,1))] font-extrabold tracking-[.06em]"
+ style={{ background: `${meta.color}1f`, color: meta.color }}
+ >
+ {meta.label}
</span>
- )}
- {!!file.file_size && <Badge>{formatSize(file.file_size)}</Badge>}
- <Badge>{formatFileDate(file.created_at, locale)}</Badge>
- {file.uploaded_by_name && <Badge>{file.uploaded_by_name}</Badge>}
+ {isWalletPass(file.mime_type, file.original_name) && (
+ <span className="flex items-center gap-[3px] rounded-full bg-m-act px-[7px] py-[2px] font-geist text-[length:calc(9px*var(--fs-scale-caption,1))] font-bold text-m-actfg">
+ <Wallet size={9} strokeWidth={2.4} aria-hidden="true" />
+ {APPLE_WALLET}
+ </span>
+ )}
+ {!!file.file_size && <Badge>{formatSize(file.file_size)}</Badge>}
+ <Badge>{formatFileDate(file.created_at, locale)}</Badge>
+ {file.uploaded_by_name && <Badge>{file.uploaded_by_name}</Badge>}
+ </div>
</div>
</div>
@@ -264,11 +281,11 @@ export function FilePreviewPane({ file, planner, onOpen, onStar, onLinks, onMenu
</p>
)}
- <div className="flex items-center gap-2">
+ <div className="flex flex-wrap items-center gap-2">
<button
type="button"
onClick={onOpen}
- className="flex h-10 flex-[1.4] items-center justify-center gap-[6px] rounded-full bg-m-act text-caption font-semibold text-m-actfg outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--m-act)] focus-visible:ring-offset-2"
+ className="flex h-10 flex-[1.4_1_auto] items-center justify-center gap-[6px] whitespace-nowrap rounded-full bg-m-act px-[14px] text-caption font-semibold text-m-actfg outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--m-act)] focus-visible:ring-offset-2"
>
<ExternalLink size={14} strokeWidth={2.2} />
{t('common.open')}
@@ -285,12 +302,7 @@ export function FilePreviewPane({ file, planner, onOpen, onStar, onLinks, onMenu
{t('files.link')}
</button>
)}
- <button
- type="button"
- onClick={onMenu}
- aria-label={t('files.menu')}
- className={`${actionBtn} w-10 flex-none px-0`}
- >
+ <button type="button" onClick={onMenu} aria-label={t('files.menu')} className={`${roundAction} w-10 flex-none`}>
<MoreHorizontal size={15} strokeWidth={2.2} />
</button>
</div>
diff --git a/client/src/mobile/screens/trip/tabs/MFilesTab.tsx b/client/src/mobile/screens/trip/tabs/MFilesTab.tsx
index 2cf95e3ad..22706eaca 100644
--- a/client/src/mobile/screens/trip/tabs/MFilesTab.tsx
+++ b/client/src/mobile/screens/trip/tabs/MFilesTab.tsx
@@ -205,7 +205,7 @@ export default function MFilesTab({ planner, shell }: MTabScreenProps) {
<FileTile
key={file.id}
file={file}
- selected={picked?.id === file.id}
+ selected={split ? picked?.id === file.id : undefined}
canStar={planner.can('file_edit', planner.trip)}
onPick={() => (split ? setPickedId(file.id) : openRow(file))}
onStar={() => void toggleStar(file)}
@@ -351,9 +351,16 @@ function FileRow({ file, planner, onOpen, onStar, onMenu }: {
</div>
{linkLabels.length > 0 && (
+ // One badge per link, the kind beside the name, so two links never run
+ // together; the last one that does not fit ends in an ellipsis.
<div className="mt-1 flex items-center gap-1 overflow-hidden text-m-faint">
<Link size={9} strokeWidth={2.4} className="flex-none" />
- <span className="truncate font-geist text-[0.5625rem] font-bold">{linkLabels.join(' · ')}</span>
+ {linkLabels.map((label, i) => (
+ <span key={i} className="flex min-w-0 flex-none items-center gap-[3px] rounded-full bg-[color:var(--m-ic)] px-[6px] py-px font-geist text-[0.5625rem] font-bold last:flex-initial">
+ <span className="flex-none uppercase tracking-[.06em]">{label.kind}</span>
+ {label.name && <span className="min-w-0 truncate text-m-muted">{label.name}</span>}
+ </span>
+ ))}
</div>
)}
</div>
diff --git a/client/src/mobile/screens/trip/tabs/MPackingListTab.tsx b/client/src/mobile/screens/trip/tabs/MPackingListTab.tsx
index 19b5a8dd7..6e80a8595 100644
--- a/client/src/mobile/screens/trip/tabs/MPackingListTab.tsx
+++ b/client/src/mobile/screens/trip/tabs/MPackingListTab.tsx
@@ -105,9 +105,13 @@ export default function MPackingListTab({ planner }: { planner: TripPlanner }) {
}
}
+ // Two switches, each a segmented control of its own on its own track: whose
+ // list, and which items. As five loose pills in one row with two of them lit,
+ // they read as one control with two answers.
+ const filterTrackCls = 'flex min-w-0 gap-[2px] rounded-full bg-[color:var(--m-ic)] p-[3px] wide:flex-none'
const filterPillCls = (active: boolean) =>
- `flex-1 whitespace-nowrap rounded-full px-2 py-[6px] text-center text-[0.71875rem] font-semibold wide:flex-none wide:px-[14px] ${
- active ? 'bg-m-act text-m-actfg' : 'bg-[color:var(--m-ic)] text-m-ink'
+ `flex-1 whitespace-nowrap rounded-full px-2 py-[5px] text-center text-[0.71875rem] font-semibold wide:flex-none wide:px-[14px] ${
+ active ? 'bg-m-act text-m-actfg' : 'text-m-ink'
}`
const trueEmpty = items.length === 0
@@ -280,13 +284,16 @@ export default function MPackingListTab({ planner }: { planner: TripPlanner }) {
{/* ── Filters (spec §4.3) ── */}
{!trueEmpty && (
- <div className="mt-[10px] flex items-center gap-[6px]">
- <button type="button" onClick={() => setView('common')} className={filterPillCls(view === 'common')}>{t('packing.viewCommon')}</button>
- <button type="button" onClick={() => setView('personal')} className={filterPillCls(view === 'personal')}>{t('packing.viewPersonal')}</button>
- <span className="h-4 w-px flex-none bg-[color:var(--m-rowbr)]" />
- <button type="button" onClick={() => setStatusFilter('all')} className={filterPillCls(statusFilter === 'all')}>{t('packing.filterAll')}</button>
- <button type="button" onClick={() => setStatusFilter('open')} className={filterPillCls(statusFilter === 'open')}>{t('packing.filterOpen')}</button>
- <button type="button" onClick={() => setStatusFilter('done')} className={filterPillCls(statusFilter === 'done')}>{t('packing.filterDone')}</button>
+ <div className="mt-[10px] flex items-center gap-[10px]">
+ <div className={`${filterTrackCls} flex-[2]`}>
+ <button type="button" aria-pressed={view === 'common'} onClick={() => setView('common')} className={filterPillCls(view === 'common')}>{t('packing.viewCommon')}</button>
+ <button type="button" aria-pressed={view === 'personal'} onClick={() => setView('personal')} className={filterPillCls(view === 'personal')}>{t('packing.viewPersonal')}</button>
+ </div>
+ <div className={`${filterTrackCls} flex-[3]`}>
+ <button type="button" aria-pressed={statusFilter === 'all'} onClick={() => setStatusFilter('all')} className={filterPillCls(statusFilter === 'all')}>{t('packing.filterAll')}</button>
+ <button type="button" aria-pressed={statusFilter === 'open'} onClick={() => setStatusFilter('open')} className={filterPillCls(statusFilter === 'open')}>{t('packing.filterOpen')}</button>
+ <button type="button" aria-pressed={statusFilter === 'done'} onClick={() => setStatusFilter('done')} className={filterPillCls(statusFilter === 'done')}>{t('packing.filterDone')}</button>
+ </div>
</div>
)}
@@ -692,7 +699,7 @@ function PackingItemRow({ item, planner, currentUserId, editMode, canEdit, bagTr
aria-label={item.name}
aria-pressed={!!item.checked}
className={`flex h-[22px] w-[22px] flex-none items-center justify-center rounded-[7px] border-[1.5px] ${
- item.checked ? 'border-m-act bg-m-act text-m-actfg' : partlyPacked ? 'border-m-act text-transparent' : 'border-[color:var(--m-rowbr)] text-transparent'
+ item.checked ? 'border-m-act bg-m-act text-m-actfg' : partlyPacked ? 'border-m-act text-transparent' : 'border-[color:var(--m-checkbr)] text-transparent'
}`}
>
<Check size={12} strokeWidth={3} />
diff --git a/client/src/mobile/screens/trip/tabs/MReservationCardParts.test.tsx b/client/src/mobile/screens/trip/tabs/MReservationCardParts.test.tsx
index 9f483f12f..3067d1fb0 100644
--- a/client/src/mobile/screens/trip/tabs/MReservationCardParts.test.tsx
+++ b/client/src/mobile/screens/trip/tabs/MReservationCardParts.test.tsx
@@ -48,10 +48,30 @@ describe('MReservationCardParts', () => {
expect(onOpen).toHaveBeenCalledOnce();
});
- it('FE-COMP-MRESCARD-011: the title keeps one line on a phone and may take two in a wide window column', () => {
+ it('FE-COMP-MRESCARD-011: the title leads and may take two lines; the pills follow it and wrap under it', () => {
render(<CardTitleButton res={reservation()} TypeIcon={Plane} typeColor="#123456" onOpen={vi.fn()} t={t} />);
const title = screen.getByText('LH 400');
- expect(title).toHaveClass('truncate', 'wide:line-clamp-2', 'wide:whitespace-normal');
+ expect(title).toHaveClass('line-clamp-2', 'flex-[1_1_auto]', 'wide:basis-full');
+ expect(title).not.toHaveClass('truncate');
+ const button = screen.getByRole('button');
+ expect(button).toHaveClass('flex-wrap');
+ expect(button.firstElementChild).toBe(title);
+ });
+
+ it('FE-COMP-MRESCARD-012: the time cell is never narrower than its value', () => {
+ render(
+ <CardWhenAndCode
+ dayValue="Day 1"
+ timeValue="09:05 – 10:15 Uhr"
+ code={null}
+ card={cardState()}
+ onOpen={vi.fn()}
+ t={t}
+ />
+ );
+ const cell = screen.getByText('09:05 – 10:15 Uhr').parentElement as HTMLElement;
+ expect(cell).toHaveClass('min-w-max');
+ expect(screen.getByText('Day 1').parentElement).toHaveClass('min-w-0');
});
it('FE-COMP-MRESCARD-002: the title button flags a booking that needs review (booking variant)', () => {
diff --git a/client/src/mobile/screens/trip/tabs/MReservationCardParts.tsx b/client/src/mobile/screens/trip/tabs/MReservationCardParts.tsx
index f45d72679..122781c1c 100644
--- a/client/src/mobile/screens/trip/tabs/MReservationCardParts.tsx
+++ b/client/src/mobile/screens/trip/tabs/MReservationCardParts.tsx
@@ -17,7 +17,14 @@ import { ConfirmationCode, Field } from './tabChrome';
type T = ReturnType<typeof useTranslation>['t'];
type CardState = ReturnType<typeof useReservationCard>;
-/** Header button: type pill, title and the needs-review badge. */
+/**
+ * Header button: title, type pill and the needs-review badge. The title takes
+ * the line first and may run to a second one; where it and the pills do not
+ * fit side by side, the pills move under it rather than squeezing the title
+ * down to a few letters ("Hotel The Celestine Kyot…"). On a wide window they
+ * always stand under it, so the cards side by side in a row keep headers of
+ * one height and their date rows on one line.
+ */
export function CardTitleButton({
res,
TypeIcon,
@@ -32,14 +39,18 @@ export function CardTitleButton({
t: T;
}) {
return (
- <button type="button" onClick={onOpen} className="flex min-w-0 flex-1 items-center gap-[7px] text-start">
+ <button
+ type="button"
+ onClick={onOpen}
+ className="flex min-w-0 flex-1 flex-wrap items-center gap-x-[7px] gap-y-1 text-start"
+ >
+ <span dir="auto" className="line-clamp-2 min-w-0 flex-[1_1_auto] break-words text-[0.78125rem] font-bold text-m-ink wide:basis-full">
+ {res.title}
+ </span>
<span className="inline-flex flex-none items-center gap-1 rounded-full border border-[color:var(--m-rowbr)] bg-m-card px-2 py-[2px] font-geist text-[0.5625rem] font-bold uppercase tracking-[.06em] text-m-muted">
<TypeIcon size={10} strokeWidth={2.2} style={{ color: typeColor }} />
{t(`reservations.type.${res.type}`)}
</span>
- <span dir="auto" className="min-w-0 flex-1 truncate text-[0.78125rem] font-bold text-m-ink wide:line-clamp-2 wide:whitespace-normal">
- {res.title}
- </span>
{!!res.needs_review && (
<span className="flex-none rounded-full bg-[rgba(232,161,58,.16)] px-2 py-[2px] font-geist text-[0.5rem] font-bold uppercase tracking-[.03em] text-[color:var(--m-st-pending)]">
{t('reservations.needsReview')}
@@ -112,7 +123,8 @@ export function CardWhenAndCode({
dayValue
)}
</Field>
- <Field label={t('reservations.time')} className="flex-1" tabular>
+ {/* The time is never cut: a range keeps its end (the date gives way first). */}
+ <Field label={t('reservations.time')} className="flex-1" tabular fit>
{timeValue}
</Field>
</div>
diff --git a/client/src/mobile/screens/trip/tabs/MTodoListTab.tsx b/client/src/mobile/screens/trip/tabs/MTodoListTab.tsx
index 50d15fcba..d4ef542ce 100644
--- a/client/src/mobile/screens/trip/tabs/MTodoListTab.tsx
+++ b/client/src/mobile/screens/trip/tabs/MTodoListTab.tsx
@@ -1,6 +1,7 @@
import { useState } from 'react'
import { Calendar, Check, ChevronRight, Flag, Plus } from 'lucide-react'
import MDancingTrek from '../../../components/MDancingTrek'
+import MChipStrip from '../../../components/MChipStrip'
import { useAuthStore } from '../../../../store/authStore'
import { useTranslation } from '../../../../i18n'
import { avatarSrc } from '../../../../utils/avatarSrc'
@@ -84,7 +85,7 @@ export default function MTodoListTab({ planner }: { planner: TripPlanner }) {
<div className="rounded-2xl border border-[color:var(--m-rowbr)] bg-[color:var(--m-ic)] px-[14px] py-[13px]">
<div className="flex items-baseline gap-[7px]">
<span className="font-geist text-[1rem] font-extrabold tabular-nums text-m-ink">{counts.done}/{items.length}</span>
- <span className="font-geist text-[0.625rem] font-bold text-m-faint">{pct}% · {t('todo.completed')}</span>
+ <span className="font-geist text-[0.625rem] font-bold text-m-faint">{pct}% {t('todo.completed')}</span>
{canEdit && (
<button
type="button"
@@ -136,7 +137,7 @@ export default function MTodoListTab({ planner }: { planner: TripPlanner }) {
{/* ── Filters (spec §4.6) ── */}
{!split && items.length > 0 && (
- <div className="mt-[10px] flex items-center gap-[6px] overflow-x-auto whitespace-nowrap">
+ <MChipStrip className="mt-[10px] items-center gap-[6px] whitespace-nowrap">
{TODO_SMART_FILTERS.map(f => (
<button
key={f}
@@ -161,7 +162,7 @@ export default function MTodoListTab({ planner }: { planner: TripPlanner }) {
<span className="font-geist text-[0.5625rem] opacity-70">{catCount(cat)}</span>
</button>
))}
- </div>
+ </MChipStrip>
)}
{/* ── Task cards (spec §4.7) ── */}
@@ -230,7 +231,7 @@ function TaskCard({ item, members, today, onToggle, onOpen }: {
aria-label={item.name}
aria-pressed={done}
className={`mt-[1px] flex h-[19px] w-[19px] flex-none items-center justify-center rounded-[6px] border-[1.5px] ${
- done ? 'border-m-act bg-m-act text-m-actfg' : 'border-[color:var(--m-rowbr)] text-transparent'
+ done ? 'border-m-act bg-m-act text-m-actfg' : 'border-[color:var(--m-checkbr)] text-transparent'
}`}
>
<Check size={12} strokeWidth={3} />
diff --git a/client/src/mobile/screens/trip/tabs/filesModel.ts b/client/src/mobile/screens/trip/tabs/filesModel.ts
index 181c594bb..842839f83 100644
--- a/client/src/mobile/screens/trip/tabs/filesModel.ts
+++ b/client/src/mobile/screens/trip/tabs/filesModel.ts
@@ -72,11 +72,18 @@ export function formatFileDate(dateStr: string | null | undefined, locale: strin
return date.toLocaleDateString(locale, { day: 'numeric', month: 'short' })
}
+/** What a file is linked to, as the row shows it: the kind of thing, and its name. */
+export interface FileLinkLabel {
+ kind: string
+ name?: string
+}
+
/**
- * The link row's joined descriptor list (spec 03 §5.2: "Links mit '·' gejoint"):
- * one "{Kategorie} · {Name}" string per linked place / reservation (transport
- * vs. booking split like FileManagerRow.tsx's SourceBadge list) plus a
- * Collab-Notes entry when note_id is set.
+ * The link row's descriptors (spec 03 §5.2): one kind and name per linked place /
+ * reservation (transport vs. booking split like FileManagerRow.tsx's SourceBadge
+ * list) plus a Collab-Notes entry when note_id is set. The row draws each as a
+ * badge of its own; joined into one string with dots, a kind and a name and the
+ * next kind read as one run.
*/
export function buildFileLinkLabels(
file: TripFile,
@@ -84,15 +91,15 @@ export function buildFileLinkLabels(
reservations: Reservation[],
transportTypes: Set<string>,
t: TranslationFn,
-): string[] {
+): FileLinkLabel[] {
const linked = linkedFileTargets(file, places, reservations, transportTypes)
- const labels = linked.places.map(place => `${t('files.sourcePlan')} · ${place.name}`)
+ const labels: FileLinkLabel[] = linked.places.map(place => ({ kind: t('files.sourcePlan'), name: place.name }))
for (const { reservation, transport } of linked.reservations) {
const key = transport ? 'files.sourceTransport' : 'files.sourceBooking'
- labels.push(`${t(key)} · ${reservation.title || t(key)}`)
+ labels.push({ kind: t(key), name: reservation.title || undefined })
}
- if (file.note_id != null) labels.push(t('files.sourceCollab'))
+ if (file.note_id != null) labels.push({ kind: t('files.sourceCollab') })
return labels
}
diff --git a/client/src/mobile/screens/trip/tabs/tabChrome.tsx b/client/src/mobile/screens/trip/tabs/tabChrome.tsx
index 0ea0c3e6c..12cf12265 100644
--- a/client/src/mobile/screens/trip/tabs/tabChrome.tsx
+++ b/client/src/mobile/screens/trip/tabs/tabChrome.tsx
@@ -38,9 +38,9 @@ const PANE_INSETS = 'pb-[calc(var(--bottom-nav-h,84px)+22px)] pt-[calc(var(--m-s
/**
* The cards of a list tab (transports, bookings, tasks, polls): one column on a
- * phone; on a wide window as many columns of at least a phone's width as the
- * page holds, three on a 13" iPad on its side, two upright or on an unfolded
- * foldable on its side, one in a narrow Split View. The cards flow down the
+ * phone; on a wide window as many columns of at least a large phone's width as
+ * the page holds, three on a 13" iPad on its side, two upright or on an unfolded
+ * foldable on its side, one on an 11" iPad upright or in a narrow Split View. The cards flow down the
* columns, each keeping its own height, so the columns start level and no
* short card ends above its neighbour in a ragged row or stretches into an
* empty panel. In date order that reads down the first column, then the next.
@@ -48,8 +48,10 @@ const PANE_INSETS = 'pb-[calc(var(--bottom-nav-h,84px)+22px)] pt-[calc(var(--m-s
* columns start on one line in every engine.
*/
export function CardGrid({ children }: { children: ReactNode }) {
+ // 380px a column: one column until the page has room for two cards that keep
+ // their titles and time ranges whole (an 11" iPad upright stays at one).
return (
- <div className="wide:columns-[340px] wide:gap-x-3 wide:pt-2 wide:[&>*]:mb-3 wide:[&>*]:mt-0 wide:[&>*]:break-inside-avoid">
+ <div className="wide:columns-[380px] wide:gap-x-3 wide:pt-2 wide:[&>*]:mb-3 wide:[&>*]:mt-0 wide:[&>*]:break-inside-avoid">
{children}
</div>
)
@@ -169,14 +171,16 @@ export function SectionHeader({ label, count, open, onToggle }: {
* the transport / booking cards (spec 03 §1.1). Width is set by the caller via
* `className` (e.g. flex weights); `tabular` aligns times and prices.
*/
-export function Field({ label, children, className = '', tabular = false }: {
+export function Field({ label, children, className = '', tabular = false, fit = false }: {
label: string
children: ReactNode
className?: string
tabular?: boolean
+ /** Never narrower than its value: the cells beside it give way instead. */
+ fit?: boolean
}) {
return (
- <div className={`min-w-0 ${className}`}>
+ <div className={`${fit ? 'min-w-max' : 'min-w-0'} ${className}`}>
<div className="mb-[3px] font-geist text-[0.5625rem] font-bold uppercase tracking-[.08em] text-m-faint">
{label}
</div>
diff --git a/client/src/mobile/screens/trip/tabs/transportsModel.ts b/client/src/mobile/screens/trip/tabs/transportsModel.ts
index c59d1b62c..1bc8c4505 100644
--- a/client/src/mobile/screens/trip/tabs/transportsModel.ts
+++ b/client/src/mobile/screens/trip/tabs/transportsModel.ts
@@ -44,6 +44,22 @@ export function parseTransportMeta(res: Reservation): TransportMeta {
}
}
+/**
+ * A start time, or a range to an end time, as the card's time cell shows it. A
+ * unit both ends carry is said once, after the range ("09:05 – 10:15 Uhr", not
+ * "09:05 Uhr – 10:15 Uhr", "9:05 – 10:15 AM"): the doubled one made a German
+ * range too long for its cell, and it was cut before its end.
+ */
+export function timeRange(start: string, end: string | null, locale: string, timeFormat: string): string {
+ const from = formatTime(start, locale, timeFormat)
+ if (!end) return from
+ const to = formatTime(end, locale, timeFormat)
+ // The word after the last space, where it holds no digit: "Uhr", "AM", "PM".
+ const space = from.lastIndexOf(' ')
+ const unit = space > 0 && !/\d/.test(from.slice(space)) ? from.slice(space) : ''
+ return unit && to.endsWith(unit) ? `${from.slice(0, space)} – ${to}` : `${from} – ${to}`
+}
+
/**
* The date and time cells of a phone booking or transport card: the day (or day
* range) the booking sits on with its calendar date beside it, else its own
@@ -62,9 +78,7 @@ export function cardWhen(
const fmtDate = (date: string) =>
new Date(`${date}T00:00:00Z`).toLocaleDateString(locale, { day: 'numeric', month: 'short', timeZone: 'UTC' })
const dayLabel = (day: Day) => day.title || t('dayplan.dayN', { n: day.day_number })
- const timeValue = startDt.time
- ? `${formatTime(startDt.time, locale, timeFormat)}${endDt.time ? ` – ${formatTime(endDt.time, locale, timeFormat)}` : ''}`
- : '—'
+ const timeValue = startDt.time ? timeRange(startDt.time, endDt.time, locale, timeFormat) : '—'
const rangeEnd = startDay && endDay && endDay.id !== startDay.id ? endDay : undefined
const dayValue = startDay
? `${dayLabel(startDay)}${rangeEnd ? ` – ${dayLabel(rangeEnd)}` : ''}`
diff --git a/client/tests/unit/mobile/largeScreenPanes.test.tsx b/client/tests/unit/mobile/largeScreenPanes.test.tsx
index 4dc60e1f1..d0f6c988a 100644
--- a/client/tests/unit/mobile/largeScreenPanes.test.tsx
+++ b/client/tests/unit/mobile/largeScreenPanes.test.tsx
@@ -191,7 +191,7 @@ describe('list tabs on a wide window', () => {
</CardGrid>
);
const grid = container.firstChild as HTMLElement;
- expect(grid.className).toContain('wide:columns-[340px]');
+ expect(grid.className).toContain('wide:columns-[380px]');
// No card splits across two columns, and none keeps a top margin that
// would start its column lower than the next.
expect(grid.className).toContain('wide:[&>*]:break-inside-avoid');
diff --git a/client/tests/unit/mobile/largeScreenTrip.test.tsx b/client/tests/unit/mobile/largeScreenTrip.test.tsx
new file mode 100644
index 000000000..ec8aa88d3
--- /dev/null
+++ b/client/tests/unit/mobile/largeScreenTrip.test.tsx
@@ -0,0 +1,273 @@
+import { act, fireEvent, renderHook } from '@testing-library/react';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { openingView } from '../../../src/components/Map/openingView';
+import MChipStrip from '../../../src/mobile/components/MChipStrip';
+import { edgeFadeClass, useEdgeFade } from '../../../src/mobile/components/useEdgeFade';
+import { DayRailSteps, GlassSegment, HeaderActions } from '../../../src/mobile/screens/trip/MTripShellParts';
+import { FilePreviewPane, FileTile } from '../../../src/mobile/screens/trip/tabs/MFilesBoard';
+import type { TripFile } from '../../../src/types';
+import { buildPlanner } from '../../helpers/mobileTrip';
+import { render, screen } from '../../helpers/render';
+import { setSizeClass } from '../../helpers/sizeClass';
+
+// FE-MOB-LSTRIP-001 onwards: the trip screen's pieces on an iPad or an unfolded foldable,
+// after the large-screen review.
+
+const t = (key: string) => key;
+
+/** A box whose sizes the test sets, since jsdom lays nothing out. */
+function box(sizes: Partial<Record<'scrollWidth' | 'clientWidth' | 'scrollHeight' | 'clientHeight', number>>) {
+ const el = document.createElement('div');
+ for (const [key, value] of Object.entries(sizes)) {
+ Object.defineProperty(el, key, { configurable: true, value });
+ }
+ return el;
+}
+
+describe('useEdgeFade down a list', () => {
+ it('FE-MOB-LSTRIP-001: a list that runs on fades at the bottom, then at both ends, then at the top', () => {
+ const el = box({ scrollHeight: 1200, clientHeight: 400 });
+ const { result } = renderHook(() => useEdgeFade(el, 'y'));
+ expect(edgeFadeClass(result.current, 'y')).toBe('m-fade-b');
+
+ act(() => {
+ el.scrollTop = 300;
+ el.dispatchEvent(new Event('scroll'));
+ });
+ expect(edgeFadeClass(result.current, 'y')).toBe('m-fade-tb');
+
+ act(() => {
+ el.scrollTop = 800;
+ el.dispatchEvent(new Event('scroll'));
+ });
+ expect(edgeFadeClass(result.current, 'y')).toBe('m-fade-t');
+ // The sideways classes stay the sideways ones.
+ expect(edgeFadeClass({ start: true, end: true })).toBe('m-fade-se');
+ });
+
+ it('FE-MOB-LSTRIP-002: new content past the edge is noticed without a scroll or a resize', async () => {
+ let height = 400;
+ const el = document.createElement('div');
+ Object.defineProperty(el, 'scrollHeight', { configurable: true, get: () => height });
+ Object.defineProperty(el, 'clientHeight', { configurable: true, value: 400 });
+ const { result } = renderHook(() => useEdgeFade(el, 'y'));
+ expect(result.current).toEqual({ start: false, end: false });
+
+ height = 900;
+ await act(async () => {
+ el.appendChild(document.createElement('p'));
+ await new Promise((resolve) => setTimeout(resolve, 40));
+ });
+ expect(result.current).toEqual({ start: false, end: true });
+ });
+});
+
+describe('MChipStrip', () => {
+ it('FE-MOB-LSTRIP-003: a chip row shrinks to its room and scrolls inside it, named where it is a set of filters', () => {
+ render(
+ <div className="flex">
+ <MChipStrip className="flex-1 gap-[6px]" label="Filters">
+ <button type="button">All</button>
+ </MChipStrip>
+ <button type="button">New note</button>
+ </div>
+ );
+ const strip = screen.getByRole('group', { name: 'Filters' });
+ expect(strip).toHaveClass('min-w-0', 'overflow-x-auto', 'flex-1');
+ });
+});
+
+describe('the top controls of a trip', () => {
+ afterEach(() => vi.restoreAllMocks());
+
+ it('FE-MOB-LSTRIP-004: a segmented control keeps to the room between the back and the trailing button', () => {
+ const { container } = render(
+ <GlassSegment activeKey="b">
+ <button type="button" aria-pressed={false}>
+ A
+ </button>
+ <button type="button" aria-pressed>
+ B
+ </button>
+ </GlassSegment>
+ );
+ const region = container.firstElementChild as HTMLElement;
+ expect(region).toHaveClass('start-12', 'end-12', 'pointer-events-none');
+ expect(region).not.toHaveClass('inset-x-0');
+ const track = container.querySelector('.m-seg') as HTMLElement;
+ expect(track).toHaveClass('overflow-x-auto', 'min-w-0');
+ expect(track.dataset.tight).toBe('false');
+ });
+
+ it('FE-MOB-LSTRIP-005: a control too wide for its room draws its segments tighter and shows the one that is on', () => {
+ vi.spyOn(HTMLElement.prototype, 'scrollWidth', 'get').mockImplementation(function (this: HTMLElement) {
+ return this.classList.contains('m-seg') ? 320 : 0;
+ });
+ vi.spyOn(HTMLElement.prototype, 'clientWidth', 'get').mockImplementation(function (this: HTMLElement) {
+ return this.classList.contains('m-seg') ? 240 : 0;
+ });
+ const seen = vi.fn();
+ HTMLElement.prototype.scrollIntoView = seen;
+ const { container } = render(
+ <GlassSegment activeKey="notes">
+ <button type="button" aria-pressed={false}>
+ Chat
+ </button>
+ <button type="button" aria-pressed>
+ Notizen
+ </button>
+ </GlassSegment>
+ );
+ expect((container.querySelector('.m-seg') as HTMLElement).dataset.tight).toBe('true');
+ expect(seen).toHaveBeenCalledWith({ block: 'nearest', inline: 'nearest' });
+ expect(seen.mock.contexts[0]).toBe(screen.getByText('Notizen'));
+ });
+
+ it('FE-MOB-LSTRIP-006: on a wide window a list tab puts its pill in the middle and its buttons at the end, on every tab alike', () => {
+ setSizeClass('wide');
+ const { container } = render(
+ <HeaderActions phone="absolute inset-x-0 mx-auto w-fit" primary={<button type="button">Add</button>}>
+ <button type="button">Export</button>
+ </HeaderActions>
+ );
+ const bar = container.firstElementChild as HTMLElement;
+ expect(bar).toHaveClass('grid', 'grid-cols-[minmax(48px,1fr)_auto_minmax(max-content,1fr)]');
+ expect(screen.getByText('Add').parentElement).toHaveClass('col-start-2');
+ expect(screen.getByText('Export').parentElement).toHaveClass('col-start-3', 'justify-self-end');
+ });
+
+ it('FE-MOB-LSTRIP-007: on a phone the pill and its buttons stay one group where the tab puts it', () => {
+ const { container } = render(
+ <HeaderActions phone="absolute start-[52px] end-2 justify-center" primary={<button type="button">Add</button>}>
+ <button type="button">Export</button>
+ </HeaderActions>
+ );
+ const bar = container.firstElementChild as HTMLElement;
+ expect(bar).toHaveClass('absolute', 'start-[52px]', 'end-2', 'justify-center', 'flex', 'gap-[7px]');
+ expect(screen.getByText('Add').parentElement).toBe(bar);
+ expect(screen.getByText('Export').parentElement).toBe(bar);
+ });
+});
+
+describe('the day strip on a wide window', () => {
+ /** A strip 400px wide at x 100, with five 120px days laid out in reading order. */
+ function rail(rtl = false, scrolled = 0) {
+ const el = document.createElement('div');
+ if (rtl) el.style.direction = 'rtl';
+ el.getBoundingClientRect = () => ({ left: 100, right: 500, top: 0, bottom: 40, width: 400, height: 40 }) as DOMRect;
+ const chips = Array.from({ length: 5 }, (_, i) => {
+ const chip = document.createElement('button');
+ chip.textContent = `Day ${i + 1}`;
+ const from = rtl ? 500 - (i + 1) * 120 + scrolled : 100 + i * 120 - scrolled;
+ chip.getBoundingClientRect = () =>
+ ({ left: from, right: from + 120, top: 0, bottom: 40, width: 120, height: 40 }) as DOMRect;
+ chip.scrollIntoView = vi.fn();
+ el.appendChild(chip);
+ return chip;
+ });
+ document.body.appendChild(el);
+ return { el, chips };
+ }
+
+ afterEach(() => {
+ document.body.innerHTML = '';
+ });
+
+ it('FE-MOB-LSTRIP-008: a chevron over the faded end brings the day the edge cuts to the start, for the eye and the finger only', () => {
+ setSizeClass('wide');
+ const { el, chips } = rail();
+ const { container } = render(<DayRailSteps rail={el} fade={{ start: false, end: true }} />);
+ const steps = container.querySelectorAll('button');
+ expect(steps).toHaveLength(1);
+ expect(steps[0]).toHaveAttribute('aria-hidden', 'true');
+ expect(steps[0]).toHaveAttribute('tabindex', '-1');
+ fireEvent.click(steps[0]);
+ // Day 4 runs from 460 to 580, past the end at 500.
+ expect(chips[3].scrollIntoView).toHaveBeenCalledWith(
+ expect.objectContaining({ inline: 'start', block: 'nearest' })
+ );
+ expect(chips[4].scrollIntoView).not.toHaveBeenCalled();
+ });
+
+ it('FE-MOB-LSTRIP-009: back towards the start, in reading order in a right-to-left strip; a phone keeps the fade alone', () => {
+ setSizeClass('wide');
+ // Scrolled by 200 towards the end: in a right-to-left strip days 1 and 2 lie past the right edge.
+ const { el, chips } = rail(true, 200);
+ const { container, unmount } = render(<DayRailSteps rail={el} fade={{ start: true, end: false }} />);
+ fireEvent.click(container.querySelector('button') as HTMLButtonElement);
+ expect(chips[1].scrollIntoView).toHaveBeenCalledWith(expect.objectContaining({ inline: 'end', block: 'nearest' }));
+ expect(chips[0].scrollIntoView).not.toHaveBeenCalled();
+ unmount();
+
+ setSizeClass('compact');
+ const phone = render(<DayRailSteps rail={el} fade={{ start: true, end: true }} />);
+ expect(phone.container.querySelector('button')).toBeNull();
+ });
+});
+
+describe('the files board', () => {
+ const pdf = {
+ id: 5,
+ trip_id: 1,
+ original_name: 'Rail pass.pdf',
+ mime_type: 'application/pdf',
+ file_size: 2048,
+ url: '/uploads/files/pass.pdf',
+ created_at: '2026-05-01T10:00:00Z',
+ } as unknown as TripFile;
+
+ it('FE-MOB-LSTRIP-010: a tile that opens its file is a plain button; beside the preview it says whether it is the picked one', () => {
+ const handlers = { canStar: false, onPick: vi.fn(), onStar: vi.fn(), onMenu: vi.fn(), t };
+ const { unmount } = render(<FileTile file={pdf} {...handlers} />);
+ expect(screen.getByRole('button', { name: /Rail pass/ })).not.toHaveAttribute('aria-pressed');
+ unmount();
+ render(<FileTile file={pdf} selected {...handlers} />);
+ expect(screen.getByRole('button', { name: /Rail pass/ })).toHaveAttribute('aria-pressed', 'true');
+ });
+
+ it('FE-MOB-LSTRIP-011: a PDF the engine cannot draw in the page gets its type tile beside its name, not a page-high box', () => {
+ const planner = buildPlanner();
+ const { container } = render(
+ <FilePreviewPane
+ file={pdf}
+ planner={planner}
+ onOpen={vi.fn()}
+ onStar={vi.fn()}
+ onLinks={vi.fn()}
+ onMenu={vi.fn()}
+ />
+ );
+ expect(container.querySelector('object')).toBeNull();
+ expect(container.querySelector('.aspect-\\[4\\/5\\]')).toBeNull();
+ const heading = screen.getByRole('heading', { name: 'Rail pass.pdf' });
+ const tile = container.querySelector('.h-\\[92px\\]') as HTMLElement;
+ expect(tile.parentElement).toBe(heading.parentElement?.parentElement);
+ // The actions keep their labels on one line and wrap as a row instead.
+ const open = screen.getByRole('button', { name: /common.open/ });
+ expect(open).toHaveClass('whitespace-nowrap');
+ expect(open.parentElement).toHaveClass('flex-wrap');
+ });
+});
+
+describe('openingView', () => {
+ const points = [
+ { lat: 34.9671, lng: 135.7727 },
+ { lat: 35.005, lng: 135.7649 },
+ ];
+ const options = {
+ padding: { top: 20, right: 40, bottom: 20, left: 40 },
+ lngFrame: null,
+ center: [0, 0] as [number, number],
+ zoom: 3,
+ };
+
+ it('FE-MOB-LSTRIP-012: beside a pane the map opens a whole level out and refits for its own size; elsewhere as it always has', () => {
+ const paned = openingView(points, { ...options, paned: true });
+ const plain = openingView(points, options);
+ expect(paned.zoom).toBe(Math.floor(plain.zoom));
+ expect(paned.refit).not.toBeNull();
+ expect(plain.refit).toBeNull();
+ expect(plain.framed).toBe(true);
+ expect(plain.center).toEqual(paned.center);
+ });
+});
diff --git a/client/tests/unit/mobile/trip/MBookingsTab.test.tsx b/client/tests/unit/mobile/trip/MBookingsTab.test.tsx
index e286eb338..bdf5f52c5 100644
--- a/client/tests/unit/mobile/trip/MBookingsTab.test.tsx
+++ b/client/tests/unit/mobile/trip/MBookingsTab.test.tsx
@@ -332,7 +332,7 @@ describe('MBookingsTab', () => {
renderTab()
const header = screen.getByRole('button', { name: 'reservations.confirmed2' })
const grid = header.nextElementSibling as HTMLElement
- expect(grid.className).toContain('wide:columns-[340px]')
+ expect(grid.className).toContain('wide:columns-[380px]')
expect(within(grid).getByText('Hotel Granvia')).toBeInTheDocument()
})
})
diff --git a/client/tests/unit/mobile/trip/MCostsTab.test.tsx b/client/tests/unit/mobile/trip/MCostsTab.test.tsx
index 27cd289ff..22dd074bc 100644
--- a/client/tests/unit/mobile/trip/MCostsTab.test.tsx
+++ b/client/tests/unit/mobile/trip/MCostsTab.test.tsx
@@ -657,7 +657,7 @@ describe('MCostsTab', () => {
expect(within(card).getAllByText('+$58.00')).toHaveLength(2)
expect(within(card).queryByText(/60\.00/)).not.toBeInTheDocument()
// Named by what Bob entered, as the list names it (#2525), never re-converted.
- expect(within(card).getByText('Museum · £30.00')).toBeInTheDocument()
+ expect(within(card).getByText('Museum (£30.00)')).toBeInTheDocument()
fireEvent.click(bob)
expect(bob).toHaveAttribute('aria-expanded', 'false')
diff --git a/client/tests/unit/mobile/trip/MFilesTab.test.tsx b/client/tests/unit/mobile/trip/MFilesTab.test.tsx
index 0d6d3bb68..ace5b3e87 100644
--- a/client/tests/unit/mobile/trip/MFilesTab.test.tsx
+++ b/client/tests/unit/mobile/trip/MFilesTab.test.tsx
@@ -185,8 +185,11 @@ describe('MFilesTab', () => {
expect(screen.getAllByText('May 1').length).toBeGreaterThan(0)
expect(screen.getByText('ada')).toBeInTheDocument()
expect(screen.getByText('A')).toBeInTheDocument()
- expect(screen.getByText('files.sourcePlan · Fushimi Inari')).toBeInTheDocument()
+ // Each link is a badge of its own, the kind beside the name, with no dot between.
+ const place = screen.getByText('Fushimi Inari')
+ expect(place.parentElement?.textContent).toBe('files.sourcePlanFushimi Inari')
expect(screen.getByText('files.sourceCollab')).toBeInTheDocument()
+ expect(place.closest('div')?.textContent).not.toContain('·')
})
it('FE-MOB-FTAB-028: in Arabic a size reads "2.0 KB", and names keep their own direction', () => {
diff --git a/client/tests/unit/mobile/trip/MMapArea.test.tsx b/client/tests/unit/mobile/trip/MMapArea.test.tsx
index 4b1400a2f..544437ffd 100644
--- a/client/tests/unit/mobile/trip/MMapArea.test.tsx
+++ b/client/tests/unit/mobile/trip/MMapArea.test.tsx
@@ -16,8 +16,10 @@ import type { LegAlternatives } from '../../../../src/components/Roadtrip/useRou
import { openLeg } from '../../../helpers/legAlternatives'
import { RT_ALT_BAR_LIFT } from '../../../../src/mobile/screens/trip/roadtrip/useMRtAlternatives'
import { corePoiCategories, pluginPoiCategories } from '../../../../src/components/Map/usePoiCategories'
+import { OFM_DARK } from '../../../../src/constants/mapDefaults'
+import { setSizeClass } from '../../../helpers/sizeClass'
-// FE-MOB-MAPAREA-001 to FE-MOB-MAPAREA-051
+// FE-MOB-MAPAREA-001 to FE-MOB-MAPAREA-052
//
// The stage's pins come out of the trip store rather than the planner's map list, so the
// stage fixtures seed the store and leave `mapPlaces` to stand for what the plan tab shows.
@@ -991,3 +993,24 @@ describe("MMapArea: the chat's routes", () => {
expect(onPoint).toHaveBeenCalledWith('c1', 47.75, 12.55)
})
})
+
+describe('MMapArea: the basemap in the dark theme', () => {
+ afterEach(() => document.documentElement.classList.remove('dark'))
+
+ it('FE-MOB-MAPAREA-052: beside the pane on a wide window the dark theme draws the dark basemap; a phone and the light theme keep the plan map', () => {
+ const plan = 'https://tiles.example/plan/{z}/{x}/{y}.png'
+ document.documentElement.classList.add('dark')
+ const { unmount } = renderArea({}, { mapTileUrl: plan } as Partial<TripPlanner>)
+ expect(mocks.props.tileUrl).toBe(plan)
+ unmount()
+
+ setSizeClass('split')
+ const dark = renderArea({}, { mapTileUrl: plan } as Partial<TripPlanner>)
+ expect(mocks.props.tileUrl).toBe(OFM_DARK)
+ dark.unmount()
+
+ document.documentElement.classList.remove('dark')
+ renderArea({}, { mapTileUrl: plan } as Partial<TripPlanner>)
+ expect(mocks.props.tileUrl).toBe(plan)
+ })
+})
diff --git a/client/tests/unit/mobile/trip/MPlanTimeline.test.tsx b/client/tests/unit/mobile/trip/MPlanTimeline.test.tsx
index 33dbe85a3..119130210 100644
--- a/client/tests/unit/mobile/trip/MPlanTimeline.test.tsx
+++ b/client/tests/unit/mobile/trip/MPlanTimeline.test.tsx
@@ -188,15 +188,21 @@ describe('MPlanTimeline', () => {
const { container, unmount } = renderTimeline()
// 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).
+ // The card is a frame around the scroller, so a row's fade at the edge leaves the frame whole.
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')
+ const frame = card(container).parentElement as HTMLElement
+ expect(upNext.nextElementSibling).toBe(frame)
+ expect(frame).toHaveClass('overflow-hidden', 'rounded-[22px]')
+ expect(card(container)).toHaveClass('overflow-y-auto')
+ expect(frame.parentElement).toHaveClass('flex-col', 'gap-3')
+ // On a wide window the column ends where the rail does.
+ expect(frame.parentElement).toHaveClass('wide:bottom-[calc(env(safe-area-inset-bottom,0px)+12px)]')
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).previousElementSibling).toBeNull()
+ expect(card(empty.container).parentElement?.previousElementSibling).toBeNull()
})
})
@@ -212,8 +218,12 @@ describe('MPlanTimeline', () => {
weatherTemp: 17,
})
- expect(screen.getByText(/Hotel Sacher/)).toHaveTextContent('Hotel Sacher · 11:00')
- expect(screen.getByText(/Ryokan Kyoto/)).toHaveTextContent('Ryokan Kyoto · 15:00')
+ // 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')
+ 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')
expect(screen.getByText('Capsule Tokyo')).toBeInTheDocument()
expect(screen.getByText('17°')).toBeInTheDocument()
})
@@ -557,7 +567,7 @@ describe('MPlanTimeline', () => {
expect(screen.queryByText('mobileTrip.upNext')).not.toBeInTheDocument()
// The edit header takes the up-next card's place, the timeline right under it.
- expect(card(container).previousElementSibling).toContainElement(screen.getByLabelText('mobileTrip.renameDay'))
+ expect(card(container).parentElement?.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/MTodoListTab.test.tsx b/client/tests/unit/mobile/trip/MTodoListTab.test.tsx
index cffc3c0d8..a43b666b8 100644
--- a/client/tests/unit/mobile/trip/MTodoListTab.test.tsx
+++ b/client/tests/unit/mobile/trip/MTodoListTab.test.tsx
@@ -86,7 +86,7 @@ describe('MTodoListTab', () => {
expect(screen.getByText('todo.empty')).toBeInTheDocument()
expect(screen.getByText('0/0')).toBeInTheDocument()
- expect(screen.getByText('0% · todo.completed')).toBeInTheDocument()
+ expect(screen.getByText('0% todo.completed')).toBeInTheDocument()
expect(screen.queryByRole('button', { name: /todo.filter.all/ })).not.toBeInTheDocument()
})
@@ -94,7 +94,7 @@ describe('MTodoListTab', () => {
setup([todo({ id: 1 }), todo({ id: 2, checked: 1 }), todo({ id: 3, checked: 1 }), todo({ id: 4 })])
expect(screen.getByText('2/4')).toBeInTheDocument()
- expect(screen.getByText('50% · todo.completed')).toBeInTheDocument()
+ expect(screen.getByText('50% todo.completed')).toBeInTheDocument()
})
it('FE-MOB-TODO-003: hides "new task" without packing_edit', () => {
diff --git a/client/tests/unit/mobile/trip/filesModel.test.ts b/client/tests/unit/mobile/trip/filesModel.test.ts
index d949d083f..603df58d2 100644
--- a/client/tests/unit/mobile/trip/filesModel.test.ts
+++ b/client/tests/unit/mobile/trip/filesModel.test.ts
@@ -150,7 +150,10 @@ describe('filesModel — link labels', () => {
t,
);
// 11 appears in both columns but is listed once; 99 does not exist any more
- expect(labels).toEqual(['files.sourcePlan · Louvre', 'files.sourcePlan · Eiffel Tower']);
+ expect(labels).toEqual([
+ { kind: 'files.sourcePlan', name: 'Louvre' },
+ { kind: 'files.sourcePlan', name: 'Eiffel Tower' },
+ ]);
});
it('FE-MOB-FILM-016: splits reservations into transport and booking and appends the collab note', () => {
@@ -167,11 +170,11 @@ describe('filesModel — link labels', () => {
);
expect(labels).toEqual([
- 'files.sourceTransport · LH123',
- 'files.sourceBooking · Hotel Ritz',
- // an untitled reservation repeats its own source label
- 'files.sourceBooking · files.sourceBooking',
- 'files.sourceCollab',
+ { kind: 'files.sourceTransport', name: 'LH123' },
+ { kind: 'files.sourceBooking', name: 'Hotel Ritz' },
+ // an untitled reservation is named by its kind alone
+ { kind: 'files.sourceBooking', name: undefined },
+ { kind: 'files.sourceCollab' },
]);
});
diff --git a/client/tests/unit/mobile/trip/transportsModel.test.ts b/client/tests/unit/mobile/trip/transportsModel.test.ts
index 5b49051d0..7fb740181 100644
--- a/client/tests/unit/mobile/trip/transportsModel.test.ts
+++ b/client/tests/unit/mobile/trip/transportsModel.test.ts
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
-import { cardWhen, parseTransportMeta } from '../../../../src/mobile/screens/trip/tabs/transportsModel';
+import { cardWhen, parseTransportMeta, timeRange } from '../../../../src/mobile/screens/trip/tabs/transportsModel';
import { TRANSPORT_TYPE_COLOR, groupTransports } from '../../../../src/components/Planner/bookings/bookingsModel';
import { orderedEndpoints } from '../../../../src/utils/flightLegs';
import { buildDay, buildReservation } from '../../../helpers/factories';
@@ -201,4 +201,13 @@ describe('transportsModel — cardWhen', () => {
});
expect(cardWhen(res({ reservation_time: null }), departure, undefined, t, 'en-US', '24h').dayDate).toBeNull();
});
+
+ it('FE-MOB-TRPM-019: a unit both ends of a range carry is said once, after the range', () => {
+ const r = res({ reservation_time: '2026-07-01T09:05', reservation_end_time: '2026-07-01T10:15' });
+ expect(cardWhen(r, day1, undefined, t, 'de-DE', '24h').timeValue).toBe('09:05 – 10:15 Uhr');
+ expect(cardWhen(r, day1, undefined, t, 'en-US', '12h').timeValue).toBe('9:05 – 10:15 AM');
+ expect(timeRange('11:30', '13:00', 'en-US', '12h')).toBe('11:30 AM – 1:00 PM');
+ expect(timeRange('09:05', null, 'de-DE', '24h')).toBe('09:05 Uhr');
+ expect(timeRange('09:05', '10:15', 'en-US', '24h')).toBe('09:05 – 10:15');
+ });
});