mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-27 07:07:31 +00:00
feat(mobile): the touch shell laid out for iPad and unfolded foldables
The app shows the touch shell at every size now, an iPad's and an unfolded foldable's included, instead of switching to the desktop pages from 768px. One route tree survives rotation, Split View, Stage Manager and folding, and the app's own features (Wallet, sharing into a trip, the edge swipe back) are there on the big screen too. Two size classes drive the layout (hooks/sizeClass.ts, Tailwind variants wide: and split:): - wide (600pt and taller than a phone on its side): a glass navigation rail on the leading edge replaces the dock and holds every destination with its name; sheets become centred form sheets; the trip's More menu is a popover beside the rail; lists keep a readable measure; dashboard, journey and vacay get columns; full-bleed maps run under the floating rail. - split (900pt): the trip's plan, places or road trip chain sit in a pane beside the map, which follows the plan's day; the list/map switch hides and shows the pane like a sidebar; on a foldable that reports its fold the pane ends at the fold. Settings show their sections beside the page and the dashboard keeps its widgets in a column of their own. A hardware keyboard gets the shortcuts an iPad app has (⌘1 to ⌘9 for the sections, ⌘N, ⌘, , ⌥←/⌥→ through the days, ⌃⌘S for the pane, ⌘[ back), answered by the page or, with a binary that has the keyCommands feature, handed to it as native key commands. The day strip fades at an edge that runs on, journey cards grow on a wide window and a card without a photo takes the day's colour, and the Leaflet map measures itself again when its box changes size.
This commit is contained in:
@@ -1018,6 +1018,8 @@
|
||||
"src/mobile/screens/settings/MSettingsUi.tsx": "Phone only settings UI primitives (card, row, input, button, segments, hint).",
|
||||
"src/mobile/screens/settings/MTileCacheUsage.tsx": "Phone only: the native tile cache size and clear action, which the browser build has no counterpart for.",
|
||||
"src/mobile/screens/settings/MWebPushCard.tsx": "Already shares hooks/useWebPush with components/Settings/WebPushCard.tsx.",
|
||||
"src/mobile/screens/trip/MTripRail.tsx": "Phone shell only; the trip's sections on the leading edge of a wide window in place of the dock, with the tabs and handlers MTripShell hands in.",
|
||||
"src/mobile/screens/trip/MTripShellParts.tsx": "Markup only; small pieces of MTripShell's top controls (segment pill, compact toggle, document sync button), with the state and handlers MTripShell hands in.",
|
||||
"src/mobile/screens/trip/dockTabs.ts": "Phone only helper that picks which trip tabs get a seat in the mobile dock.",
|
||||
"src/mobile/screens/trip/lib/dayNotes.ts": "Phone only helper that splits a leading time off a day note for the plan timeline.",
|
||||
"src/mobile/screens/trip/map/MMapArea.tsx": "Phone map stage framing; already shares usePoiExplore and useMergedMapPois with the desktop trip planner.",
|
||||
|
||||
@@ -87,7 +87,6 @@
|
||||
"mobile/screens/trip/map/MMapArea.tsx": 3,
|
||||
"mobile/screens/trip/tabs/MCollabPolls.tsx": 1,
|
||||
"mobile/screens/trip/tabs/MFileLightbox.tsx": 2,
|
||||
"mobile/screens/vacay/MVacay.tsx": 1,
|
||||
"mobile/screens/vacay/MVacayMonth.tsx": 1,
|
||||
"pages/AtlasPage.tsx": 2,
|
||||
"pages/JourneyDetailPage.tsx": 1,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"src/components/Admin/AdminPluginsPanel.tsx": 1266,
|
||||
"src/components/Budget/CostsPanel.test.tsx": 2730,
|
||||
"src/components/Budget/CostsPanel.tsx": 1798,
|
||||
"src/components/Map/MapView.tsx": 1214,
|
||||
"src/components/Map/MapView.tsx": 1202,
|
||||
"src/components/Map/MapViewGL.test.tsx": 2919,
|
||||
"src/components/Map/MapViewGL.tsx": 2127,
|
||||
"src/components/Planner/DayDetailPanel.test.tsx": 2333,
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
"components/Journey/JourneyDetailPageProviderPicker.tsx": 163,
|
||||
"components/Journey/JourneyDetailPageScrollTrigger.tsx": 4,
|
||||
"components/Journey/JourneyDetailPageVerdictSection.tsx": 51,
|
||||
"components/Journey/JourneyEntryCover.tsx": 15,
|
||||
"components/Journey/JourneyEntryCover.tsx": 13,
|
||||
"components/Journey/JourneyMap.tsx": 3,
|
||||
"components/Journey/JourneyMapGL.tsx": 5,
|
||||
"components/Journey/MobileEntryView.tsx": 94,
|
||||
|
||||
@@ -62,6 +62,11 @@ interface Props {
|
||||
/** The public journey page serves photos through a share token. */
|
||||
photoUrlFor?: (photoId: number) => string
|
||||
tone?: 'app' | 'mobile'
|
||||
/**
|
||||
* large: the card a wide window shows (an iPad, a foldable unfolded), with
|
||||
* the room for a two-line name and the whole place under it.
|
||||
*/
|
||||
size?: 'regular' | 'large'
|
||||
}
|
||||
|
||||
export default function JourneyEntryCover({
|
||||
@@ -73,7 +78,9 @@ export default function JourneyEntryCover({
|
||||
showWeather = true,
|
||||
photoUrlFor,
|
||||
tone = 'app',
|
||||
size = 'regular',
|
||||
}: Props) {
|
||||
const large = size === 'large'
|
||||
const { t, locale } = useTranslation()
|
||||
const isSuggestion = entry.type === 'skeleton'
|
||||
|
||||
@@ -108,7 +115,9 @@ export default function JourneyEntryCover({
|
||||
// growing its box moved every card after it once a swipe had landed, and the
|
||||
// snap then pulled the strip again, which read as a jolt (carousels keep the
|
||||
// room for it with their gap and top padding).
|
||||
className={`relative h-[152px] w-[136px] flex-none origin-bottom overflow-hidden rounded-[18px] text-start transition-[transform,box-shadow] duration-200 ease-[cubic-bezier(.2,.8,.2,1)] motion-reduce:transition-none ${
|
||||
// White on the root: every mark and line on the card is white, over a photo or
|
||||
// over the day's colour alike.
|
||||
className={`relative text-white ${large ? 'h-[196px] w-[176px]' : 'h-[152px] w-[136px]'} flex-none origin-bottom overflow-hidden rounded-[18px] text-start transition-[transform,box-shadow] duration-200 ease-[cubic-bezier(.2,.8,.2,1)] motion-reduce:transition-none ${
|
||||
isActive ? 'z-[1] scale-[1.18] shadow-[0_18px_40px_-16px_rgba(0,0,0,.55)]' : 'scale-100 shadow-[0_10px_24px_-14px_rgba(0,0,0,.5)]'
|
||||
} ${src ? '' : emptyGround} ${isSuggestion ? 'opacity-90' : ''}`}
|
||||
// backgroundImage, not background: the shorthand would drop the opaque colour
|
||||
@@ -122,7 +131,9 @@ export default function JourneyEntryCover({
|
||||
// ring lost its top edge to that clip.
|
||||
style={{
|
||||
boxShadow: `inset 0 0 0 ${isActive ? 2.5 : 1.5}px ${dayColor}${isActive ? '' : 'b3'}`,
|
||||
...(src ? null : { backgroundImage: `linear-gradient(160deg, ${dayColor}2e, ${dayColor}0d)` }),
|
||||
// Without a photograph the card is the day's colour, deep enough to carry
|
||||
// the white name like a photo does, rather than a grey that read as empty.
|
||||
...(src ? null : { backgroundImage: `linear-gradient(160deg, ${dayColor}d9, ${dayColor}8c 55%, ${dayColor}59)` }),
|
||||
}}
|
||||
>
|
||||
{src ? (
|
||||
@@ -130,8 +141,8 @@ export default function JourneyEntryCover({
|
||||
) : (
|
||||
<span className="absolute inset-0 flex items-center justify-center">
|
||||
{posterless
|
||||
? <Play size={24} strokeWidth={1.8} fill="currentColor" style={{ color: dayColor }} className="ml-0.5 opacity-60" />
|
||||
: <MapPin size={24} strokeWidth={1.8} style={{ color: dayColor }} className="opacity-60" />}
|
||||
? <Play size={24} strokeWidth={1.8} fill="currentColor" className="ml-0.5 -mt-6 opacity-80" />
|
||||
: <MapPin size={24} strokeWidth={1.8} className="-mt-6 opacity-80" />}
|
||||
</span>
|
||||
)}
|
||||
|
||||
@@ -155,7 +166,7 @@ export default function JourneyEntryCover({
|
||||
italic, dimmed title carries the rest. */}
|
||||
{isSuggestion && (
|
||||
<span
|
||||
className={`absolute top-2 ${entry.country_code ? 'start-[30px]' : 'start-2'} ${badgeDot} text-white`}
|
||||
className={`absolute top-2 ${entry.country_code ? 'start-[30px]' : 'start-2'} ${badgeDot}`}
|
||||
title={t('journey.entry.suggestion')}
|
||||
aria-label={t('journey.entry.suggestion')}
|
||||
>
|
||||
@@ -172,7 +183,7 @@ export default function JourneyEntryCover({
|
||||
</span>
|
||||
)}
|
||||
{weather && (
|
||||
<span className={`${badgeDot} text-white`}>
|
||||
<span className={`${badgeDot}`}>
|
||||
<weather.icon size={11} strokeWidth={2.4} />
|
||||
</span>
|
||||
)}
|
||||
@@ -181,11 +192,11 @@ export default function JourneyEntryCover({
|
||||
|
||||
{/* Bottom: the name gets the room the thumbnail layout never had. */}
|
||||
<span className="absolute inset-x-0 bottom-0 flex flex-col gap-[1px] px-[10px] pb-[10px]">
|
||||
<span className={`line-clamp-2 text-[13px] leading-[1.25] font-bold text-white drop-shadow-[0_1px_3px_rgba(0,0,0,.6)] ${isSuggestion ? 'italic' : ''}`}>
|
||||
<span className={`line-clamp-2 text-[13px] leading-[1.25] font-bold drop-shadow-[0_1px_3px_rgba(0,0,0,.6)] ${isSuggestion ? 'italic' : ''}`}>
|
||||
{title}
|
||||
</span>
|
||||
{place && (
|
||||
<span className="truncate text-[10.5px] leading-[1.3] font-medium text-white/80 drop-shadow-[0_1px_3px_rgba(0,0,0,.6)]">
|
||||
<span className={`${large ? 'line-clamp-2' : 'truncate'} text-[10.5px] leading-[1.3] font-medium text-white/80 drop-shadow-[0_1px_3px_rgba(0,0,0,.6)]`}>
|
||||
{place}
|
||||
</span>
|
||||
)}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import { render } from '@testing-library/react';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
// FE-MAP-RESIZE-001 onwards
|
||||
|
||||
const map = vi.hoisted(() => ({
|
||||
container: {} as HTMLElement,
|
||||
invalidateSize: vi.fn(),
|
||||
getContainer: vi.fn(),
|
||||
getCenter: vi.fn(() => ({ lat: 35, lng: 135.7 })),
|
||||
getZoom: vi.fn(() => 12),
|
||||
whenReady: vi.fn((fn: () => void) => fn()),
|
||||
on: vi.fn(),
|
||||
off: vi.fn(),
|
||||
}));
|
||||
vi.mock('react-leaflet', () => ({ useMap: () => map }));
|
||||
|
||||
import ContainerResizeWatcher, { MapCameraSnapshot } from './ContainerResizeWatcher';
|
||||
|
||||
const realObserver = globalThis.ResizeObserver;
|
||||
|
||||
describe('ContainerResizeWatcher', () => {
|
||||
afterEach(() => {
|
||||
globalThis.ResizeObserver = realObserver;
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it('FE-MAP-RESIZE-001: the map measures itself again whenever its box changes size', () => {
|
||||
const element = document.createElement('div');
|
||||
map.getContainer.mockReturnValue(element);
|
||||
let fire: () => void = () => {};
|
||||
const observe = vi.fn();
|
||||
const disconnect = vi.fn();
|
||||
globalThis.ResizeObserver = class {
|
||||
constructor(cb: () => void) {
|
||||
fire = cb;
|
||||
}
|
||||
observe = observe;
|
||||
unobserve = vi.fn();
|
||||
disconnect = disconnect;
|
||||
} as unknown as typeof ResizeObserver;
|
||||
|
||||
const { unmount } = render(<ContainerResizeWatcher />);
|
||||
expect(observe).toHaveBeenCalledWith(element);
|
||||
fire();
|
||||
expect(map.invalidateSize).toHaveBeenCalledWith();
|
||||
unmount();
|
||||
expect(disconnect).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('FE-MAP-RESIZE-002: the camera snapshot reports where the map looks and stops on unmount', () => {
|
||||
const onChange = vi.fn();
|
||||
const { unmount } = render(<MapCameraSnapshot onChange={onChange} />);
|
||||
expect(onChange).toHaveBeenCalledWith([35, 135.7], 12);
|
||||
expect(map.on).toHaveBeenCalledWith('moveend zoomend', expect.any(Function));
|
||||
unmount();
|
||||
expect(map.off).toHaveBeenCalledWith('moveend zoomend', expect.any(Function));
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useMap } from 'react-leaflet';
|
||||
|
||||
/**
|
||||
* Leaflet measures its container on window resizes only. The touch shell on a
|
||||
* wide window resizes the map without one: the trip's plan pane opens and
|
||||
* closes beside it, and a foldable folds. Without a fresh measure the map kept
|
||||
* its old size, with grey bands or tiles cut off at the old edge.
|
||||
*/
|
||||
export default function ContainerResizeWatcher() {
|
||||
const map = useMap();
|
||||
useEffect(() => {
|
||||
if (typeof ResizeObserver === 'undefined') return;
|
||||
// Leaflet's default keeps the centre where it was, so what the map framed stays
|
||||
// in the middle of the room it now has.
|
||||
const observer = new ResizeObserver(() => map.invalidateSize());
|
||||
observer.observe(map.getContainer());
|
||||
return () => observer.disconnect();
|
||||
}, [map]);
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Reports where the map looks after every move, so a remount can come back to it. */
|
||||
export function MapCameraSnapshot({ onChange }: { onChange: (center: [number, number], zoom: number) => void }) {
|
||||
const map = useMap();
|
||||
useEffect(() => {
|
||||
const save = () => {
|
||||
const center = map.getCenter();
|
||||
onChange([center.lat, center.lng], map.getZoom());
|
||||
};
|
||||
map.whenReady(save);
|
||||
map.on('moveend zoomend', save);
|
||||
return () => {
|
||||
map.off('moveend zoomend', save);
|
||||
};
|
||||
}, [map, onChange]);
|
||||
return null;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import { useEffect, useRef, useState, useMemo, useCallback, memo, type Component
|
||||
import DOM from 'react-dom'
|
||||
import { categoryIconSvg } from './categoryIconSvg'
|
||||
import { MapContainer, TileLayer, Marker, Polyline, CircleMarker, Circle, useMap, Tooltip } from 'react-leaflet'
|
||||
import ContainerResizeWatcher, { MapCameraSnapshot } from './ContainerResizeWatcher'
|
||||
import MarkerClusterGroup from 'react-leaflet-cluster'
|
||||
import { makeMarkerDraggable } from './markerDrag'
|
||||
import { CLUSTER_OPTIONS, createClusterIcon, revealInCluster, type ClusterGroupLike } from './markerCluster'
|
||||
@@ -244,20 +245,6 @@ function CameraHoverGuard({ movingRef, onMoveStart, onZoom }: { movingRef: { cur
|
||||
return null
|
||||
}
|
||||
|
||||
function MapCameraSnapshot({ onChange }: { onChange: (center: [number, number], zoom: number) => void }) {
|
||||
const map = useMap()
|
||||
useEffect(() => {
|
||||
const save = () => {
|
||||
const center = map.getCenter()
|
||||
onChange([center.lat, center.lng], map.getZoom())
|
||||
}
|
||||
map.whenReady(save)
|
||||
map.on('moveend zoomend', save)
|
||||
return () => { map.off('moveend zoomend', save) }
|
||||
}, [map, onChange])
|
||||
return null
|
||||
}
|
||||
|
||||
interface MapControllerProps {
|
||||
center: [number, number]
|
||||
zoom: number
|
||||
@@ -952,6 +939,7 @@ export const MapView = memo(function MapView({
|
||||
{/* First, so a fit or a camera request in the same commit starts from the trip's world copy. */}
|
||||
<LngFrameFollower />
|
||||
<MapController center={center} zoom={zoom} />
|
||||
<ContainerResizeWatcher />
|
||||
{hasViewBaseLayer && <MapCameraSnapshot onChange={saveCameraSnapshot} />}
|
||||
<BoundsController places={dayPlaces.length > 0 ? dayPlaces : places} routeCoords={dayPlaces.length > 0 ? routeCoords : []} fitKey={fitKey} paddingOpts={paddingOpts} framedOnMount={initialView.framed} focusPoints={focusPoints} focusKey={focusKey} fitPadding={fitPadding} follow={followSelection} />
|
||||
<SelectionController follow={followSelection} places={places} selectedPlaceId={selectedPlaceId} dayPlaces={dayPlaces} selectedPlace={selectedPlace} paddingBox={paddingBox} />
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import { useSyncExternalStore } from 'react';
|
||||
|
||||
/**
|
||||
* The touch shell's size classes, the web's answer to UIKit's compact and
|
||||
* regular widths.
|
||||
*
|
||||
* compact every phone, upright or on its side, and the narrow Split View and
|
||||
* Stage Manager windows. The shell as it has always been: the dock at
|
||||
* the bottom, sheets rising from below, one column.
|
||||
* wide from 600pt across and taller than a phone on its side: an iPad in
|
||||
* any orientation or window above a third of the screen, a foldable
|
||||
* unfolded. A navigation rail on the leading edge takes the dock's
|
||||
* place, sheets become centred form sheets, lists get columns.
|
||||
* split from 900pt across: room for two panes, so the trip's plan sits next
|
||||
* to its map and settings show their sections beside the page.
|
||||
*
|
||||
* The height bound keeps a phone on its side compact: no phone is taller than
|
||||
* 500pt in landscape, no tablet or unfolded foldable is shorter.
|
||||
*
|
||||
* `tailwind.config.js` registers the same two queries as the `wide:` and
|
||||
* `split:` variants, and `index.css` reads them for the shell's own variables;
|
||||
* keep the three in step (sizeClass.test.ts holds them together).
|
||||
*/
|
||||
export const WIDE_QUERY = '(min-width: 600px) and (min-height: 501px)';
|
||||
export const SPLIT_QUERY = '(min-width: 900px) and (min-height: 501px)';
|
||||
|
||||
function matches(query: string): boolean {
|
||||
return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(query).matches;
|
||||
}
|
||||
|
||||
function subscribe(query: string) {
|
||||
return (onChange: () => void) => {
|
||||
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return () => {};
|
||||
const mq = window.matchMedia(query);
|
||||
mq.addEventListener('change', onChange);
|
||||
return () => mq.removeEventListener('change', onChange);
|
||||
};
|
||||
}
|
||||
|
||||
const subscribeWide = subscribe(WIDE_QUERY);
|
||||
const subscribeSplit = subscribe(SPLIT_QUERY);
|
||||
const readWide = () => matches(WIDE_QUERY);
|
||||
const readSplit = () => matches(SPLIT_QUERY);
|
||||
const never = () => false;
|
||||
|
||||
/** Whether the touch shell is laid out for a wide window right now, outside React. */
|
||||
export function isWideViewport(): boolean {
|
||||
return readWide();
|
||||
}
|
||||
|
||||
/** True while the window is in the wide size class. Follows rotation, folding and resizing. */
|
||||
export function useIsWide(): boolean {
|
||||
return useSyncExternalStore(subscribeWide, readWide, never);
|
||||
}
|
||||
|
||||
/** True while the window has room for two panes side by side. */
|
||||
export function useIsSplit(): boolean {
|
||||
return useSyncExternalStore(subscribeSplit, readSplit, never);
|
||||
}
|
||||
@@ -3,6 +3,10 @@ import { useMatch } from 'react-router'
|
||||
import BottomNav from '../components/Layout/BottomNav'
|
||||
import ErrorBoundary from '../components/shared/ErrorBoundary'
|
||||
import MBottomNav from './components/MBottomNav'
|
||||
import MNavRail from './components/MNavRail'
|
||||
import { useIsWide } from '../hooks/sizeClass'
|
||||
import MKeyboardHost from './keyboard/MKeyboardHost'
|
||||
import MShellShortcuts from './keyboard/MShellShortcuts'
|
||||
import MToastHost from './components/MToastHost'
|
||||
import MEdgeBack from './components/MEdgeBack'
|
||||
import { useNativeCapabilities } from '../native/capabilities'
|
||||
@@ -39,6 +43,9 @@ export default function MobileShell({ isPhone, children }: MobileShellProps) {
|
||||
const { caps } = useNativeCapabilities()
|
||||
const pageRef = useRef<HTMLDivElement>(null)
|
||||
const edgeBack = isNativeIos() && caps.features.includes('edgeBack')
|
||||
// On a wide window (an iPad, a foldable unfolded) the rail on the leading edge
|
||||
// replaces the dock, and the page column starts after it.
|
||||
const wide = useIsWide()
|
||||
|
||||
if (!isPhone) {
|
||||
return (
|
||||
@@ -52,7 +59,7 @@ export default function MobileShell({ isPhone, children }: MobileShellProps) {
|
||||
return (
|
||||
// min-h-svh, not min-h-dvh: dvh grows while Safari's toolbar retracts, so a
|
||||
// dvh page length would chase the animation it just triggered.
|
||||
<div className="m-root flex min-h-svh flex-col text-m-ink">
|
||||
<div className="m-root m-shell flex min-h-svh flex-col text-m-ink">
|
||||
{/* Background and screen gradient live on their own viewport-sized layer.
|
||||
The shell root is as tall as the document now, and --m-scr is a radial
|
||||
gradient measured against its element box, so on it the light cone would
|
||||
@@ -66,10 +73,17 @@ export default function MobileShell({ isPhone, children }: MobileShellProps) {
|
||||
layer to be visible, body must not paint over it, which index.css handles
|
||||
for this breakpoint. */}
|
||||
<div aria-hidden className="pointer-events-none fixed inset-0 -z-10 bg-[color:var(--m-bg)] bg-[image:var(--m-scr)]" />
|
||||
<div ref={pageRef} className="flex-1">{children}</div>
|
||||
<div ref={pageRef} className="flex-1 wide:ps-[var(--m-rail-w)]">{children}</div>
|
||||
<MEdgeBack target={pageRef} enabled={edgeBack} />
|
||||
{!inTripPlanner && <ErrorBoundary boundaryId="chrome:m-bottom-nav" fallback={null}><MBottomNav /></ErrorBoundary>}
|
||||
{!inTripPlanner && (
|
||||
<ErrorBoundary boundaryId="chrome:m-bottom-nav" fallback={null}>{wide ? <MNavRail /> : <MBottomNav />}</ErrorBoundary>
|
||||
)}
|
||||
<ErrorBoundary boundaryId="chrome:m-toast" fallback={null}><MToastHost /></ErrorBoundary>
|
||||
{/* A hardware keyboard (an iPad's, mostly) gets the shortcuts an iPad app has. */}
|
||||
<ErrorBoundary boundaryId="chrome:m-keyboard" fallback={null}>
|
||||
<MKeyboardHost />
|
||||
<MShellShortcuts />
|
||||
</ErrorBoundary>
|
||||
<div id="m-sheet-root" />
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -12,7 +12,7 @@ export default function MGlassBar({ floating = true, className = '', children }:
|
||||
return (
|
||||
<div
|
||||
className={`flex items-center gap-[11px] rounded-full border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] px-[14px] py-2 backdrop-blur-[26px] backdrop-saturate-[1.7] shadow-[0_14px_34px_-16px_rgba(0,0,0,.22)] ${
|
||||
floating ? 'fixed inset-x-4 top-[var(--m-safe-top,12px)] z-30' : ''
|
||||
floating ? 'm-bar-x fixed top-[var(--m-safe-top,12px)] z-30' : ''
|
||||
} ${className}`}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
import type { LucideIcon } from 'lucide-react';
|
||||
import { Plus, Search, Settings2, Shield, Sparkles, Upload } from 'lucide-react';
|
||||
import { useLocation, useNavigate } from 'react-router';
|
||||
import { useAssistantHomeLauncher } from '../../components/Assistant/useAssistantHome';
|
||||
import { useNavItems } from '../../components/Layout/navItems';
|
||||
import { isNavItemActive, useCreateAction } from '../../components/Layout/useCreateAction';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import { useAuthStore } from '../../store/authStore';
|
||||
import MFab from './MFab';
|
||||
import { MRail, MRailButton, MRailSpacer } from './MRail';
|
||||
|
||||
interface RailEntry {
|
||||
id: string;
|
||||
label: string;
|
||||
icon: LucideIcon;
|
||||
active: boolean;
|
||||
go: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* The touch shell's navigation on a wide window (hooks/sizeClass.ts): a glass
|
||||
* rail on the leading edge, where an iPad app keeps its sidebar, in place of
|
||||
* the phone's bottom dock.
|
||||
*
|
||||
* It has the room the dock lacks, so every destination sits in it at once,
|
||||
* with its name under the icon: the dock's own items, the ones the phone keeps
|
||||
* under More, the home assistant, and settings and administration at the foot,
|
||||
* which the phone reaches through the avatar menu. The create action keeps the
|
||||
* dock's raised circle at the head, with the same context-aware meaning.
|
||||
*/
|
||||
export default function MNavRail() {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const create = useCreateAction(true);
|
||||
const assistant = useAssistantHomeLauncher();
|
||||
const isAdmin = useAuthStore((s) => s.user?.role === 'admin');
|
||||
const navItems = useNavItems();
|
||||
|
||||
const isActive = (to: string) => isNavItemActive(location.pathname, to);
|
||||
const main: RailEntry[] = [
|
||||
...navItems.map(({ to, label, icon }) => ({
|
||||
id: to,
|
||||
label,
|
||||
icon,
|
||||
active: isActive(to),
|
||||
go: () => void navigate(to),
|
||||
})),
|
||||
...(assistant.available
|
||||
? [{ id: 'assistant', label: t('assistant.launcher.tooltip'), icon: Sparkles, active: false, go: assistant.open }]
|
||||
: []),
|
||||
];
|
||||
const foot: RailEntry[] = [
|
||||
{
|
||||
id: '/settings',
|
||||
label: t('nav.bottomSettings'),
|
||||
icon: Settings2,
|
||||
active: isActive('/settings'),
|
||||
go: () => void navigate('/settings'),
|
||||
},
|
||||
...(isAdmin
|
||||
? [
|
||||
{
|
||||
id: '/admin',
|
||||
label: t('nav.bottomAdmin'),
|
||||
icon: Shield,
|
||||
active: isActive('/admin'),
|
||||
go: () => void navigate('/admin'),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
];
|
||||
|
||||
// Settings and admin have nothing to create, and /vacay draws its own action
|
||||
// (the year/edit toggle), the same exceptions the dock makes.
|
||||
const noFab = ['/settings', '/admin', '/vacay'].some((p) => location.pathname.startsWith(p));
|
||||
const searchFab = location.pathname.startsWith('/atlas');
|
||||
|
||||
return (
|
||||
<MRail label={t('mobileNav.navigation')} fixed>
|
||||
{!noFab && (
|
||||
<MFab
|
||||
onClick={create.run}
|
||||
ariaLabel={create.label}
|
||||
className="mb-2 outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--m-act)] focus-visible:ring-offset-2 focus-visible:ring-offset-[color:var(--m-bg)]"
|
||||
>
|
||||
{searchFab ? (
|
||||
<Search size={22} strokeWidth={2.4} />
|
||||
) : create.upload ? (
|
||||
<Upload size={21} strokeWidth={2.4} />
|
||||
) : (
|
||||
<Plus size={24} strokeWidth={2.4} />
|
||||
)}
|
||||
</MFab>
|
||||
)}
|
||||
{main.map((entry) => (
|
||||
<RailEntryButton key={entry.id} {...entry} />
|
||||
))}
|
||||
<MRailSpacer />
|
||||
<div aria-hidden="true" className="my-1 h-px w-8 flex-none bg-[color:var(--m-rowbr)]" />
|
||||
{foot.map((entry) => (
|
||||
<RailEntryButton key={entry.id} {...entry} />
|
||||
))}
|
||||
</MRail>
|
||||
);
|
||||
}
|
||||
|
||||
function RailEntryButton({ label, icon: Icon, active, go }: RailEntry) {
|
||||
return (
|
||||
<MRailButton label={label} active={active} onClick={go}>
|
||||
<Icon size={20} strokeWidth={active ? 2.1 : 1.9} />
|
||||
</MRailButton>
|
||||
);
|
||||
}
|
||||
@@ -13,7 +13,7 @@ export default function MPullIndicator({ state, label }: { state: PullState; lab
|
||||
aria-hidden={!state.refreshing}
|
||||
role={state.refreshing ? 'status' : undefined}
|
||||
aria-label={state.refreshing ? label : undefined}
|
||||
className="pointer-events-none fixed inset-x-0 z-30 flex justify-center transition-opacity duration-200"
|
||||
className="m-span-x pointer-events-none fixed z-30 flex justify-center transition-opacity duration-200"
|
||||
style={{ top: 'calc(var(--m-safe-top, 12px) + 70px)', opacity: visible ? Math.max(0.35, progress) : 0 }}
|
||||
>
|
||||
<span className="flex h-9 w-9 items-center justify-center rounded-full border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] text-m-ink shadow-sm backdrop-blur-xl">
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
/**
|
||||
* The glass rail on the leading edge that takes the dock's place on a wide
|
||||
* window (hooks/sizeClass.ts): the app's sections (MNavRail) or a trip's
|
||||
* (MTripRail). It sits inside the strip --m-rail-w reserves, so the page
|
||||
* column and every fixed bar start right after it.
|
||||
*/
|
||||
export function MRail({ label, fixed = false, children }: { label: string; fixed?: boolean; children: ReactNode }) {
|
||||
return (
|
||||
<nav
|
||||
aria-label={label}
|
||||
className={`m-dock-vt ${fixed ? 'fixed' : 'absolute'} bottom-[calc(env(safe-area-inset-bottom,0px)+12px)] start-[calc(var(--m-rail-w)-80px)] top-[var(--m-safe-top,12px)] z-40 flex w-[72px] flex-col items-center gap-1 overflow-y-auto rounded-[30px] border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] px-1 py-3 shadow-[0_16px_44px_-14px_rgba(0,0,0,.35)] backdrop-blur-[30px] backdrop-saturate-[1.8] [scrollbar-width:none]`}
|
||||
>
|
||||
{children}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
/** Pushes the entries after it to the foot of the rail. */
|
||||
export function MRailSpacer() {
|
||||
return <div className="flex-1" />;
|
||||
}
|
||||
|
||||
interface MRailButtonProps {
|
||||
label: string;
|
||||
active: boolean;
|
||||
onClick: () => void;
|
||||
/** The icon, drawn at 20px. */
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* One destination: the icon on the dock's 40px circle, filled while it is the
|
||||
* current one, its name underneath. Names wrap to two lines rather than being
|
||||
* cut, since a rail entry has no other way to say what it is; the title gives
|
||||
* the whole name to a pointer hovering it.
|
||||
*/
|
||||
export function MRailButton({ label, active, onClick, children }: MRailButtonProps) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
title={label}
|
||||
aria-current={active ? 'page' : undefined}
|
||||
className="group flex w-full flex-none flex-col items-center gap-[3px] rounded-[18px] px-1 py-[5px] outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--m-act)]"
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={`flex h-10 w-10 items-center justify-center rounded-full transition-colors duration-150 ${
|
||||
active ? 'bg-m-act text-m-actfg' : 'text-m-muted group-hover:bg-[color:var(--m-ic)] group-hover:text-m-ink'
|
||||
}`}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
<span
|
||||
className={`line-clamp-2 w-full hyphens-auto break-words text-center font-geist text-[length:calc(10px*var(--fs-scale-caption,1))] leading-[1.2] ${
|
||||
active ? 'font-bold text-m-ink' : 'font-semibold text-m-muted'
|
||||
}`}
|
||||
>
|
||||
{label}
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -32,21 +32,74 @@ interface MSheetProps {
|
||||
* throwing away a state that differs from the one at the first touch.
|
||||
*/
|
||||
discardGuard?: unknown
|
||||
/** Width as a centred form sheet on a wide window (default regular). */
|
||||
wideWidth?: MSheetWidth
|
||||
/** Where it stands on a wide window (default centre). */
|
||||
wideAnchor?: MSheetWideAnchor
|
||||
}
|
||||
|
||||
const EXIT_MS = 300
|
||||
|
||||
const DISCARD_BUTTON = 'rounded-full bg-danger px-4 py-2 text-body font-semibold text-white' // theme-lint-disable: white on the danger fill, as ConfirmDialog draws it
|
||||
|
||||
/**
|
||||
* How wide the sheet gets on a wide window, where it is a centred form sheet
|
||||
* rather than a panel across the screen: compact for a short list of actions,
|
||||
* regular for a form, large for a sheet that holds a page of its own.
|
||||
*/
|
||||
export type MSheetWidth = 'compact' | 'regular' | 'large'
|
||||
|
||||
// On a wide window (hooks/sizeClass.ts) a docked or floating sheet becomes
|
||||
// what iPadOS shows there: a form sheet centred over the dimmed page, as wide
|
||||
// as its content needs and no wider, instead of a band across a 13" screen.
|
||||
// Centred with auto margins between zero insets, so it needs no physical side.
|
||||
const WIDE_POSITION = 'wide:inset-x-0 wide:mx-auto wide:bottom-auto wide:top-1/2 wide:-translate-y-1/2'
|
||||
const WIDE_WIDTH: Record<MSheetWidth, string> = {
|
||||
compact: 'wide:w-[min(320px,calc(100%-48px))]',
|
||||
regular: 'wide:w-[min(540px,calc(100%-48px))]',
|
||||
large: 'wide:w-[min(720px,calc(100%-48px))]',
|
||||
}
|
||||
|
||||
const POSITION: Record<MSheetVariant, string> = {
|
||||
card: 'absolute inset-x-[14px] top-1/2 -translate-y-1/2',
|
||||
bottom: 'absolute inset-x-4 bottom-[calc(var(--bottom-nav-h,84px)+16px)]',
|
||||
drawer: 'absolute left-0 top-0 bottom-0 w-[78%] max-w-[320px]',
|
||||
}
|
||||
|
||||
/**
|
||||
* Where a sheet stands on a wide window. centre: a form sheet. rail-foot: a
|
||||
* popover beside the foot of the navigation rail, for a menu opened from there
|
||||
* (the trip's More), the way iPadOS shows a menu next to the button that
|
||||
* opened it rather than in the middle of the screen.
|
||||
*/
|
||||
export type MSheetWideAnchor = 'center' | 'rail-foot'
|
||||
const WIDE_ANCHOR: Record<MSheetWideAnchor, string> = {
|
||||
center: WIDE_POSITION,
|
||||
'rail-foot': 'wide:top-auto wide:translate-y-0 wide:end-auto wide:bottom-[calc(env(safe-area-inset-bottom,0px)+12px)] wide:start-[calc(var(--m-rail-w)+6px)]',
|
||||
}
|
||||
|
||||
/** The box the panel sits in: its place on a phone, and on a wide window. */
|
||||
function frameClass(variant: MSheetVariant, width: MSheetWidth = 'regular', anchor: MSheetWideAnchor = 'center'): string {
|
||||
if (variant === 'drawer') return POSITION.drawer
|
||||
return `${POSITION[variant]} ${WIDE_WIDTH[width]} ${WIDE_ANCHOR[anchor]}`
|
||||
}
|
||||
|
||||
/** The popover's arrow, pointing at the More button at the foot of the rail (wide windows only). */
|
||||
function PopoverArrow({ variant, anchor }: { variant: MSheetVariant; anchor?: MSheetWideAnchor }) {
|
||||
if (anchor !== 'rail-foot' || variant === 'drawer') return null
|
||||
return (
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="absolute -start-[10px] bottom-[33px] hidden h-[18px] w-[10px] bg-[color:var(--m-sheet)] backdrop-blur-[40px] [clip-path:polygon(100%_0,0_50%,100%_100%)] rtl:-scale-x-100 wide:block"
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
const WIDE_HEIGHT = 'wide:max-h-[min(calc(100dvh-var(--m-safe-top,12px)-64px),880px)]'
|
||||
|
||||
const SHAPE: Record<MSheetVariant, string> = {
|
||||
card: 'rounded-[28px] shadow-[0_30px_80px_-24px_rgba(0,0,0,.6)] max-h-[calc(100dvh-var(--m-safe-top,12px)-96px)]',
|
||||
bottom: 'rounded-[26px] shadow-[0_-8px_40px_-14px_rgba(0,0,0,.45)] max-h-[calc(100dvh-var(--bottom-nav-h,84px)-var(--m-safe-top,12px)-72px)]',
|
||||
card: `rounded-[28px] shadow-[0_30px_80px_-24px_rgba(0,0,0,.6)] max-h-[calc(100dvh-var(--m-safe-top,12px)-96px)] ${WIDE_HEIGHT}`,
|
||||
bottom: `rounded-[26px] shadow-[0_-8px_40px_-14px_rgba(0,0,0,.45)] max-h-[calc(100dvh-var(--bottom-nav-h,84px)-var(--m-safe-top,12px)-72px)] ${WIDE_HEIGHT} wide:shadow-[0_30px_80px_-24px_rgba(0,0,0,.6)]`,
|
||||
drawer: 'h-full shadow-[0_0_60px_-10px_rgba(0,0,0,.5)]',
|
||||
}
|
||||
|
||||
@@ -87,6 +140,8 @@ export default function MSheet({
|
||||
className = '',
|
||||
children,
|
||||
discardGuard,
|
||||
wideWidth,
|
||||
wideAnchor,
|
||||
}: MSheetProps) {
|
||||
const { t } = useTranslation()
|
||||
const { asking, markStart, requestClose, wouldAsk, keepEditing, discard, reset } = useDiscardGuard(discardGuard, onClose)
|
||||
@@ -187,7 +242,8 @@ export default function MSheet({
|
||||
if (e.target === e.currentTarget) requestClose()
|
||||
}}
|
||||
>
|
||||
<div className={POSITION[variant]}>
|
||||
<div className={frameClass(variant, wideWidth, wideAnchor)}>
|
||||
<PopoverArrow variant={variant} anchor={wideAnchor} />
|
||||
<div
|
||||
ref={panelRef}
|
||||
role="dialog"
|
||||
|
||||
@@ -50,7 +50,7 @@ export default function MToastHost() {
|
||||
if (toasts.length === 0) return null
|
||||
|
||||
return (
|
||||
<div className="pointer-events-none fixed inset-x-0 bottom-[calc(var(--bottom-nav-h,84px)+16px)] z-[90] flex flex-col-reverse items-center gap-2 px-6">
|
||||
<div className="m-span-x pointer-events-none fixed bottom-[calc(var(--bottom-nav-h,84px)+16px)] z-[90] flex flex-col-reverse items-center gap-2 px-6">
|
||||
{toasts.map((toast) => (
|
||||
<MToastPill key={toast.id} toast={toast} onDismiss={dismissToast} />
|
||||
))}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export interface EdgeFade {
|
||||
/** Content is scrolled past the leading edge. */
|
||||
start: boolean;
|
||||
/** More content waits beyond the trailing edge. */
|
||||
end: boolean;
|
||||
}
|
||||
|
||||
const NONE: EdgeFade = { start: false, end: false };
|
||||
|
||||
/**
|
||||
* Which ends of a horizontal scroller have more behind them, so the strip can
|
||||
* fade out there (m-fade-s / m-fade-e in mobile.css) instead of cutting a chip
|
||||
* in half with nothing to say the row goes on. Follows scrolling and every
|
||||
* change of size: a rotation, a fold, the pane beside the map opening.
|
||||
*/
|
||||
export function useEdgeFade(el: HTMLElement | null): 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 = Math.abs(el.scrollLeft);
|
||||
const room = el.scrollWidth - el.clientWidth;
|
||||
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);
|
||||
return () => {
|
||||
el.removeEventListener('scroll', measure);
|
||||
observer?.disconnect();
|
||||
};
|
||||
}, [el]);
|
||||
return fade;
|
||||
}
|
||||
|
||||
/** The mask classes for a fade state. */
|
||||
export function edgeFadeClass(fade: EdgeFade): string {
|
||||
if (fade.start && fade.end) return 'm-fade-se';
|
||||
if (fade.start) return 'm-fade-s';
|
||||
if (fade.end) return 'm-fade-e';
|
||||
return '';
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useNativeCapabilities } from '../../native/capabilities';
|
||||
import { isNativeIos } from '../../native/platform';
|
||||
import { reportNativeFailure } from '../../native/reportFailure';
|
||||
import { TrekShell } from '../../native/trekShell';
|
||||
import { findShortcut, toNativeCommand, useShortcutRegistry } from './shortcuts';
|
||||
|
||||
/**
|
||||
* Answers the touch shell's keyboard shortcuts (useShortcuts), once for every
|
||||
* screen. In a browser it listens for the keys itself. In the app the binary
|
||||
* takes them over as native key commands when it can (feature keyCommands),
|
||||
* which puts them in the overlay a held ⌘ shows and in the iPadOS menu bar;
|
||||
* the page then leaves those keys alone, so nothing runs twice.
|
||||
*/
|
||||
export default function MKeyboardHost() {
|
||||
const lists = useShortcutRegistry((s) => s.lists);
|
||||
const { caps } = useNativeCapabilities();
|
||||
const native = isNativeIos() && caps.features.includes('keyCommands');
|
||||
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.defaultPrevented || e.isComposing) return;
|
||||
const all = lists.map((l) => l.shortcuts);
|
||||
const hit = findShortcut(e, native ? all.map((l) => l.filter((s) => !s.mod && !s.ctrl)) : all);
|
||||
if (!hit) return;
|
||||
e.preventDefault();
|
||||
hit.run();
|
||||
};
|
||||
document.addEventListener('keydown', onKey);
|
||||
return () => document.removeEventListener('keydown', onKey);
|
||||
}, [lists, native]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!native) return;
|
||||
const commands = lists.flatMap((l) =>
|
||||
l.shortcuts.filter((s) => s.mod || s.ctrl).map((s) => toNativeCommand(l.owner, s))
|
||||
);
|
||||
TrekShell.setKeyCommands({ commands }).catch(reportNativeFailure);
|
||||
}, [lists, native]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!native) return;
|
||||
let cancelled = false;
|
||||
let remove: (() => Promise<void>) | null = null;
|
||||
TrekShell.addListener('keyCommand', ({ id }) => {
|
||||
const at = id.indexOf(':');
|
||||
const owner = id.slice(0, at);
|
||||
const list = useShortcutRegistry.getState().lists.find((l) => l.owner === owner);
|
||||
list?.shortcuts.find((s) => s.id === id.slice(at + 1))?.run();
|
||||
})
|
||||
.then((handle) => {
|
||||
if (cancelled) void handle.remove();
|
||||
else remove = handle.remove;
|
||||
})
|
||||
.catch(reportNativeFailure);
|
||||
return () => {
|
||||
cancelled = true;
|
||||
if (remove) void remove();
|
||||
};
|
||||
}, [native]);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { useLocation, useMatch, useNavigate } from 'react-router';
|
||||
import { useNavItems } from '../../components/Layout/navItems';
|
||||
import { useCreateAction } from '../../components/Layout/useCreateAction';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import type { Shortcut } from './shortcuts';
|
||||
import { useShortcuts } from './useShortcuts';
|
||||
|
||||
/**
|
||||
* The app-wide shortcuts of the touch shell: ⌘1 to ⌘9 for the sections in the
|
||||
* order the rail shows them, ⌘N for what the "+" creates here, ⌘, for
|
||||
* settings. Inside a trip the numbers belong to the trip's own sections
|
||||
* (MTripShell), so the shell lets go of them there.
|
||||
*/
|
||||
export default function MShellShortcuts() {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const inTrip = useMatch('/trips/:id');
|
||||
const navItems = useNavItems();
|
||||
const create = useCreateAction(true);
|
||||
const noCreate = ['/settings', '/admin', '/vacay'].some((p) => location.pathname.startsWith(p));
|
||||
|
||||
const shortcuts: Shortcut[] = [
|
||||
...(inTrip
|
||||
? []
|
||||
: navItems.slice(0, 9).map((item, i) => ({
|
||||
id: `go-${item.id}`,
|
||||
title: item.label,
|
||||
key: String(i + 1),
|
||||
mod: true,
|
||||
run: () => void navigate(item.to),
|
||||
}))),
|
||||
...(noCreate ? [] : [{ id: 'create', title: create.label, key: 'n', mod: true, run: create.run }]),
|
||||
{ id: 'settings', title: t('nav.bottomSettings'), key: ',', mod: true, run: () => void navigate('/settings') },
|
||||
];
|
||||
useShortcuts('shell', shortcuts);
|
||||
return null;
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
import { create } from 'zustand';
|
||||
import type { NativeKeyCommand } from '../../native/trekShell';
|
||||
|
||||
/**
|
||||
* A hardware keyboard shortcut of the touch shell. The shell is what an iPad
|
||||
* shows, and an iPad often has a keyboard attached: there the app should
|
||||
* answer ⌘1 and ⌘N the way any iPad app does.
|
||||
*/
|
||||
export interface Shortcut {
|
||||
/** Stable id, also what the app's native key command reports back. */
|
||||
id: string;
|
||||
/** Its name, for the overlay a held ⌘ shows and the iPadOS menu bar. */
|
||||
title: string;
|
||||
/** KeyboardEvent.key, lower case for letters ('n', '1', ',', 'ArrowLeft'). */
|
||||
key: string;
|
||||
/** ⌘ on Apple keyboards, Ctrl elsewhere. */
|
||||
mod?: boolean;
|
||||
shift?: boolean;
|
||||
alt?: boolean;
|
||||
/** The physical Control key on top of ⌘ (⌃⌘S). */
|
||||
ctrl?: boolean;
|
||||
run: () => void;
|
||||
}
|
||||
|
||||
/** Whether an event is this shortcut. ⌘ and Ctrl both count as the command key. */
|
||||
export function matchesShortcut(
|
||||
e: Pick<KeyboardEvent, 'key' | 'metaKey' | 'ctrlKey' | 'shiftKey' | 'altKey'>,
|
||||
s: Shortcut
|
||||
): boolean {
|
||||
const key = e.key.length === 1 ? e.key.toLowerCase() : e.key;
|
||||
if (key !== s.key) return false;
|
||||
if (s.ctrl) {
|
||||
if (!e.ctrlKey || !e.metaKey) return false;
|
||||
} else if (!!s.mod !== (e.metaKey || e.ctrlKey)) {
|
||||
return false;
|
||||
}
|
||||
return !!s.shift === e.shiftKey && !!s.alt === e.altKey;
|
||||
}
|
||||
|
||||
/** Typing in a field keeps its keys: a shortcut without ⌘ never fires there. */
|
||||
export function isTypingTarget(target: EventTarget | null): boolean {
|
||||
if (!(target instanceof HTMLElement)) return false;
|
||||
if (target.isContentEditable) return true;
|
||||
const tag = target.tagName;
|
||||
return tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT';
|
||||
}
|
||||
|
||||
/** The first shortcut of the lists (later ones first) that the event is. */
|
||||
export function findShortcut(
|
||||
e: Pick<KeyboardEvent, 'key' | 'metaKey' | 'ctrlKey' | 'shiftKey' | 'altKey' | 'target'>,
|
||||
lists: Shortcut[][]
|
||||
): Shortcut | null {
|
||||
for (let i = lists.length - 1; i >= 0; i--) {
|
||||
for (const s of lists[i]) {
|
||||
if (!s.mod && !s.ctrl && isTypingTarget(e.target)) continue;
|
||||
if (matchesShortcut(e, s)) return s;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
interface ShortcutRegistry {
|
||||
/** The lists that are live, by owner, in the order they were registered. */
|
||||
lists: { owner: string; shortcuts: Shortcut[] }[];
|
||||
set: (owner: string, shortcuts: Shortcut[]) => void;
|
||||
remove: (owner: string) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Every screen's live shortcuts in one place, so a single keydown listener and
|
||||
* the app's native key commands (NativeKeyCommands) answer for all of them, a
|
||||
* trip's own shortcuts ahead of the shell's.
|
||||
*/
|
||||
export const useShortcutRegistry = create<ShortcutRegistry>((set) => ({
|
||||
lists: [],
|
||||
set: (owner, shortcuts) =>
|
||||
set((state) => {
|
||||
const at = state.lists.findIndex((l) => l.owner === owner);
|
||||
if (at === -1) return { lists: [...state.lists, { owner, shortcuts }] };
|
||||
const lists = state.lists.slice();
|
||||
lists[at] = { owner, shortcuts };
|
||||
return { lists };
|
||||
}),
|
||||
remove: (owner) => set((state) => ({ lists: state.lists.filter((l) => l.owner !== owner) })),
|
||||
}));
|
||||
|
||||
const NATIVE_KEYS: Record<string, string> = {
|
||||
ArrowLeft: 'left',
|
||||
ArrowRight: 'right',
|
||||
ArrowUp: 'up',
|
||||
ArrowDown: 'down',
|
||||
Escape: 'escape',
|
||||
};
|
||||
|
||||
/** A shortcut as the app's UIKeyCommand, under an id unique across screens. */
|
||||
export function toNativeCommand(owner: string, s: Shortcut): NativeKeyCommand {
|
||||
const modifiers: string[] = [];
|
||||
if (s.mod || s.ctrl) modifiers.push('command');
|
||||
if (s.ctrl) modifiers.push('control');
|
||||
if (s.shift) modifiers.push('shift');
|
||||
if (s.alt) modifiers.push('option');
|
||||
return { id: `${owner}:${s.id}`, title: s.title, input: NATIVE_KEYS[s.key] ?? s.key, modifiers };
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { useShortcutRegistry, type Shortcut } from './shortcuts';
|
||||
|
||||
/**
|
||||
* Registers a screen's keyboard shortcuts while it is mounted (MKeyboardHost
|
||||
* answers them). The list may be rebuilt on every render: the registry only
|
||||
* changes when a shortcut's id, name or keys do, and pressing one always runs
|
||||
* the newest handler.
|
||||
*/
|
||||
export function useShortcuts(owner: string, shortcuts: Shortcut[]): void {
|
||||
const latest = useRef(shortcuts);
|
||||
useEffect(() => {
|
||||
latest.current = shortcuts;
|
||||
});
|
||||
const signature = shortcuts.map((s) => [s.id, s.title, s.key, s.mod, s.shift, s.alt, s.ctrl].join('|')).join('\n');
|
||||
const setList = useShortcutRegistry((s) => s.set);
|
||||
const remove = useShortcutRegistry((s) => s.remove);
|
||||
// Re-registered when the signature changes, never for a new handler alone:
|
||||
// each registered shortcut runs whatever handler is newest when pressed.
|
||||
useEffect(() => {
|
||||
setList(
|
||||
owner,
|
||||
latest.current.map((s) => ({ ...s, run: () => latest.current.find((x) => x.id === s.id)?.run() }))
|
||||
);
|
||||
}, [owner, signature, setList]);
|
||||
useEffect(() => () => remove(owner), [owner, remove]);
|
||||
}
|
||||
@@ -53,6 +53,22 @@
|
||||
* real devices derive them from the safe-area insets. */
|
||||
--bottom-nav-h: calc(84px + env(safe-area-inset-bottom, 0px));
|
||||
--m-safe-top: calc(env(safe-area-inset-top, 0px) + 12px);
|
||||
/* The navigation rail's share of the leading edge (wide windows only), what
|
||||
* every full-width fixed bar and the page column start after. */
|
||||
--m-rail-w: 0px;
|
||||
}
|
||||
|
||||
/* Wide size class (hooks/sizeClass.ts WIDE_QUERY): the rail on the leading
|
||||
* edge takes the dock's place, so nothing docks at the bottom any more and
|
||||
* content only clears the home indicator. */
|
||||
@media (min-width: 600px) and (min-height: 501px) {
|
||||
.m-root {
|
||||
--bottom-nav-h: env(safe-area-inset-bottom, 0px);
|
||||
--m-rail-w: calc(env(safe-area-inset-left, 0px) + 92px);
|
||||
}
|
||||
:root[dir='rtl'] .m-root {
|
||||
--m-rail-w: calc(env(safe-area-inset-right, 0px) + 92px);
|
||||
}
|
||||
}
|
||||
|
||||
.dark .m-root {
|
||||
@@ -143,6 +159,18 @@
|
||||
to { opacity: 0; transform: translateY(6px); }
|
||||
}
|
||||
|
||||
/* A form sheet on a wide window sits mid-screen, so it rises from the bottom
|
||||
edge of the window rather than from just below its own resting place. */
|
||||
@media (min-width: 600px) and (min-height: 501px) {
|
||||
@keyframes m-sheet-up {
|
||||
from { transform: translateY(calc(50dvh + 50%)); }
|
||||
to { transform: translateY(0); }
|
||||
}
|
||||
@keyframes m-sheet-down {
|
||||
from { transform: translateY(0); }
|
||||
to { transform: translateY(calc(50dvh + 50%)); }
|
||||
}
|
||||
}
|
||||
.m-sheet-in { animation: m-sheet-in 260ms var(--ease-out-quint) both; }
|
||||
.m-sheet-out { animation: m-sheet-out 220ms var(--ease-drawer) both; }
|
||||
.m-sheet-up { animation: m-sheet-up 420ms var(--ease-drawer) both; }
|
||||
@@ -499,3 +527,94 @@
|
||||
.m-root [data-field-trigger='pad'] {
|
||||
padding-inline: 14px !important;
|
||||
}
|
||||
|
||||
/* ── The page column on a wide window ───────────────────────────────────────
|
||||
Fixed bars span the page, not the window: they start after the navigation
|
||||
rail (--m-rail-w, 0 on a phone, so these are the phone's insets there). */
|
||||
.m-bar-x {
|
||||
inset-inline-start: calc(var(--m-rail-w, 0px) + 16px);
|
||||
inset-inline-end: 16px;
|
||||
}
|
||||
.m-span-x {
|
||||
inset-inline-start: var(--m-rail-w, 0px);
|
||||
inset-inline-end: 0;
|
||||
}
|
||||
/* A screen whose background is a map reaches under the rail: the map runs to
|
||||
the window's edge and the rail floats over it like the top controls do. Its
|
||||
own bars then keep to the page column with m-bar-x / m-span-x. */
|
||||
.m-bleed {
|
||||
margin-inline-start: calc(var(--m-rail-w, 0px) * -1);
|
||||
}
|
||||
/* The trip's pane beside the map (split size class, MTripShell): a third of
|
||||
the window, within what a list and its rows need. On a foldable that reports
|
||||
its fold (two horizontal viewport segments), the pane takes the first half
|
||||
to the fold exactly, so no row runs across the crease and the map has the
|
||||
other half to itself. */
|
||||
.m-trip {
|
||||
--trip-pane-open: clamp(360px, 38vw, 460px);
|
||||
}
|
||||
@media (horizontal-viewport-segments: 2) {
|
||||
.m-trip {
|
||||
--trip-pane-open: calc(env(viewport-segment-width 0 0, 50vw) - var(--m-rail-w, 0px));
|
||||
}
|
||||
}
|
||||
|
||||
/* The phone rules of index.css, for the app. It shows this shell at every
|
||||
size, an iPad's included (mobile/useIsPhone.ts), where their media query does
|
||||
not match; the shell's root carries .m-shell, so they follow it there: the
|
||||
document is the scroller, the shell paints the background, no zoom buttons
|
||||
on a touch map, no scrollbars. */
|
||||
html:has(.m-shell) {
|
||||
overflow: visible;
|
||||
overscroll-behavior: none;
|
||||
}
|
||||
html:has(.m-shell) body {
|
||||
height: auto;
|
||||
overflow: visible;
|
||||
overflow-x: clip;
|
||||
background-color: transparent;
|
||||
}
|
||||
html:has(.m-shell) .leaflet-control-zoom {
|
||||
display: none !important;
|
||||
}
|
||||
html:has(.m-shell) * {
|
||||
scrollbar-width: none;
|
||||
}
|
||||
html:has(.m-shell) ::-webkit-scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/* While the trip's map runs under the rail (MTripShell, --trip-map-inset), the
|
||||
controls both engines draw in its corners step clear of the rail. A margin on
|
||||
the leading side moves only the corner next to the rail, in either reading
|
||||
direction: the corner on the far side is anchored there and does not move. */
|
||||
.m-trip .leaflet-control-container > div,
|
||||
.m-trip .maplibregl-control-container > div,
|
||||
.m-trip .mapboxgl-control-container > div {
|
||||
margin-inline-start: var(--trip-map-inset, 0px);
|
||||
}
|
||||
|
||||
/* A horizontal strip with more behind an edge fades out there
|
||||
(components/useEdgeFade.ts), so a cut chip reads as "the row goes on". */
|
||||
.m-fade-s,
|
||||
.m-fade-e,
|
||||
.m-fade-se {
|
||||
--m-fade-w: 28px;
|
||||
-webkit-mask-image: var(--m-fade-mask);
|
||||
mask-image: var(--m-fade-mask);
|
||||
}
|
||||
.m-fade-s {
|
||||
--m-fade-mask: linear-gradient(var(--m-fade-dir, 90deg), transparent 0, #000 var(--m-fade-w));
|
||||
}
|
||||
.m-fade-e {
|
||||
--m-fade-mask: linear-gradient(var(--m-fade-dir, 90deg), #000 calc(100% - var(--m-fade-w)), transparent 100%);
|
||||
}
|
||||
.m-fade-se {
|
||||
--m-fade-mask: linear-gradient(var(--m-fade-dir, 90deg), transparent 0, #000 var(--m-fade-w), #000 calc(100% - var(--m-fade-w)), transparent 100%);
|
||||
}
|
||||
:root[dir='rtl'] .m-fade-s,
|
||||
:root[dir='rtl'] .m-fade-e,
|
||||
:root[dir='rtl'] .m-fade-se {
|
||||
--m-fade-dir: 270deg;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ export default function MAdmin() {
|
||||
return (
|
||||
// Flow screen: scrolls with the document (#1809), so no height and no
|
||||
// scroll container of its own.
|
||||
<div className="px-4 pb-[calc(var(--bottom-nav-h,84px)+16px)] pt-[var(--m-safe-top,12px)]">
|
||||
<div className="px-4 pb-[calc(var(--bottom-nav-h,84px)+16px)] pt-[var(--m-safe-top,12px)] wide:mx-auto wide:max-w-[1040px] wide:px-6">
|
||||
{/* Header: back · section switcher · create user */}
|
||||
<div className="mb-3 flex items-center gap-2">
|
||||
<button
|
||||
|
||||
@@ -109,7 +109,7 @@ export default function MAtlas() {
|
||||
return (
|
||||
// h-dvh, not h-full: the shell stopped providing a definite height (#1809)
|
||||
// and a map on a percentage of an auto-height parent collapses to zero.
|
||||
<div className="relative h-dvh overflow-hidden">
|
||||
<div className="m-bleed relative h-dvh overflow-hidden">
|
||||
<div ref={mapRef} className="absolute inset-0 z-[1] bg-[color:var(--m-mapb)] [&_.leaflet-control-zoom]:hidden" />
|
||||
{/* Region hover tooltip — positioned imperatively by useAtlas. */}
|
||||
<div
|
||||
@@ -120,7 +120,7 @@ export default function MAtlas() {
|
||||
|
||||
{/* Full-width bucket-list button. The bottom nav makes a back button
|
||||
redundant on this main-nav screen, so the header spans the width. */}
|
||||
<div className="absolute inset-x-4 top-[var(--m-safe-top,12px)] z-[5] flex items-center gap-2">
|
||||
<div className="m-bar-x absolute top-[var(--m-safe-top,12px)] z-[5] flex items-center gap-2 wide:mx-auto wide:max-w-[720px]">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setBucketOpen(true)}
|
||||
|
||||
@@ -24,7 +24,7 @@ export default function MAtlasStatsCard({ stats }: MAtlasStatsCardProps) {
|
||||
const planned = stats.totalCountriesPlanned || 0
|
||||
|
||||
return (
|
||||
<div className="absolute bottom-[calc(var(--bottom-nav-h,84px)+16px)] inset-x-4 z-[5]">
|
||||
<div className="m-bar-x absolute bottom-[calc(var(--bottom-nav-h,84px)+16px)] z-[5] wide:mx-auto wide:max-w-[720px]">
|
||||
<div className="flex w-full rounded-[22px] border border-[color:var(--m-shbr)] bg-[color:var(--m-sheet)] px-3 py-[14px] shadow-[0_18px_44px_-20px_rgba(0,0,0,.4)]">
|
||||
{cols.map(([n, l], i) => (
|
||||
<div key={l} className="flex-1 text-center">
|
||||
|
||||
@@ -153,7 +153,7 @@ export default function MCollections() {
|
||||
// Map view fills the viewport like the trip and journal maps do (#2104);
|
||||
// h-dvh because the shell owns no scroll container (#1809). List view
|
||||
// keeps the document as the scroller.
|
||||
className={`px-4 pb-[calc(var(--bottom-nav-h,84px)+12px)] pt-[var(--m-safe-top,12px)] ${c.view === 'map' ? 'flex h-dvh flex-col overflow-hidden' : ''}`}
|
||||
className={`px-4 pb-[calc(var(--bottom-nav-h,84px)+12px)] pt-[var(--m-safe-top,12px)] wide:px-6 ${c.view === 'map' ? 'flex h-dvh flex-col overflow-hidden' : 'wide:mx-auto wide:max-w-[1040px]'}`}
|
||||
>
|
||||
{/* Header: back · list switcher · edit · share */}
|
||||
<div className="mb-3 flex flex-none items-center gap-2 pt-2">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import React, { useEffect, useRef, useState } from 'react'
|
||||
import { useIsSplit } from '../../../hooks/sizeClass'
|
||||
import {
|
||||
Archive, ArchiveRestore, ArrowRight, Bell, CalendarDays, CalendarPlus, Copy,
|
||||
LayoutGrid, List, MapPin, Pencil, Plus, RefreshCw, Sparkles, Trash2, Users,
|
||||
@@ -58,6 +59,7 @@ export default function MDashboard(): React.ReactElement {
|
||||
const unread = useInAppNotificationStore(s => s.unreadCount)
|
||||
const fetchUnreadCount = useInAppNotificationStore(s => s.fetchUnreadCount)
|
||||
const [menuOpen, setMenuOpen] = useState(false)
|
||||
const split = useIsSplit()
|
||||
const { available: assistantAvailable, open: openAssistant } = useAssistantHomeLauncher()
|
||||
const [subOpen, setSubOpen] = useState(false)
|
||||
|
||||
@@ -179,7 +181,7 @@ export default function MDashboard(): React.ReactElement {
|
||||
)}
|
||||
|
||||
{viewMode === 'grid' ? (
|
||||
<div className="mt-[10px] flex flex-col gap-3">
|
||||
<div className="mt-[10px] flex flex-col gap-3 wide:grid wide:grid-cols-[repeat(auto-fill,minmax(300px,1fr))] wide:gap-4">
|
||||
{gridTrips.map(trip => (
|
||||
<MTripGridCard
|
||||
key={trip.id}
|
||||
@@ -193,7 +195,7 @@ export default function MDashboard(): React.ReactElement {
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="mt-[10px] flex flex-col gap-3">
|
||||
<div className="mt-[10px] flex flex-col gap-3 wide:grid wide:grid-cols-[repeat(auto-fill,minmax(300px,1fr))] wide:gap-x-4">
|
||||
{gridTrips.map(trip => (
|
||||
<MTripListCard
|
||||
key={trip.id}
|
||||
@@ -256,7 +258,7 @@ export default function MDashboard(): React.ReactElement {
|
||||
{demoMode && <MDemoWelcome />}
|
||||
|
||||
<MPullIndicator state={pull} label={t('common.loading')} />
|
||||
<div ref={contentRef} className="px-4 pb-[calc(var(--bottom-nav-h,84px)+32px)] pt-[calc(var(--m-safe-top,12px)+82px)]">
|
||||
<div ref={contentRef} className="px-4 pb-[calc(var(--bottom-nav-h,84px)+32px)] pt-[calc(var(--m-safe-top,12px)+82px)] wide:mx-auto wide:max-w-[1280px] wide:px-6">
|
||||
{loadError && (
|
||||
<div role="alert" className="mb-3 flex items-center gap-3 rounded-[20px] border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] p-[14px]">
|
||||
<span className="min-w-0 flex-1 text-[0.8125rem] font-medium text-m-ink">{t('dashboard.loadErrorBanner')}</span>
|
||||
@@ -271,24 +273,36 @@ export default function MDashboard(): React.ReactElement {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{spotlight && (
|
||||
<MSpotlightCard
|
||||
trip={spotlight}
|
||||
t={t}
|
||||
onOpen={() => navigate(`/trips/${spotlight.id}`)}
|
||||
actions={actionsFor(spotlight, 'list')}
|
||||
/>
|
||||
)}
|
||||
|
||||
{dashOrder.map(id => (
|
||||
<React.Fragment key={id}>{renderBlock(id)}</React.Fragment>
|
||||
))}
|
||||
|
||||
{widgetPlugins.length > 0 && (
|
||||
<div className="mt-3 flex flex-col gap-3">
|
||||
<PluginWidgets plugins={widgetPlugins} tripId={spotlight ? String(spotlight.id) : null} />
|
||||
{/* Beside each other from the split size class on, the way the desktop
|
||||
dashboard holds them: the trips in the main column, the widgets in a
|
||||
column of their own, each in the order the user set. */}
|
||||
<div className="split:grid split:grid-cols-[minmax(0,1fr)_minmax(300px,360px)] split:items-start split:gap-6">
|
||||
<div className="min-w-0">
|
||||
{spotlight && (
|
||||
<MSpotlightCard
|
||||
trip={spotlight}
|
||||
t={t}
|
||||
onOpen={() => navigate(`/trips/${spotlight.id}`)}
|
||||
actions={actionsFor(spotlight, 'list')}
|
||||
/>
|
||||
)}
|
||||
{(split ? dashOrder.filter(id => id === 'trips') : dashOrder).map(id => (
|
||||
<React.Fragment key={id}>{renderBlock(id)}</React.Fragment>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{(split || widgetPlugins.length > 0) && (
|
||||
<div className="min-w-0 split:sticky split:top-[calc(var(--m-safe-top,12px)+82px)] split:-mt-[14px]">
|
||||
{split && dashOrder.filter(id => id !== 'trips').map(id => (
|
||||
<React.Fragment key={id}>{renderBlock(id)}</React.Fragment>
|
||||
))}
|
||||
{widgetPlugins.length > 0 && (
|
||||
<div className="mt-3 flex flex-col gap-3">
|
||||
<PluginWidgets plugins={widgetPlugins} tripId={spotlight ? String(spotlight.id) : null} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<MNewTripSheet
|
||||
@@ -377,7 +391,7 @@ function MSpotlightCard({ trip, t, onOpen, actions }: {
|
||||
tabIndex={0}
|
||||
onClick={onOpen}
|
||||
onKeyDown={e => { if (e.key === 'Enter') onOpen() }}
|
||||
className="relative h-[300px] cursor-pointer overflow-hidden rounded-[26px] shadow-[0_24px_56px_-22px_rgba(0,0,0,.5)]"
|
||||
className="relative h-[300px] cursor-pointer overflow-hidden rounded-[26px] shadow-[0_24px_56px_-22px_rgba(0,0,0,.5)] outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--m-act)] wide:h-[clamp(300px,42vh,440px)]"
|
||||
>
|
||||
{trip.cover_image
|
||||
? <img src={trip.cover_image} alt={trip.title} className="absolute inset-0 h-full w-full object-cover" />
|
||||
@@ -385,7 +399,7 @@ function MSpotlightCard({ trip, t, onOpen, actions }: {
|
||||
<div className="absolute end-[10px] top-[10px] flex gap-[6px]">
|
||||
{actions.map(a => <CoverActionBtn key={a.key} action={a} />)}
|
||||
</div>
|
||||
<div className="absolute bottom-[10px] inset-x-[10px] rounded-[18px] border border-white/[.16] bg-[rgba(14,14,17,.52)] p-[12px_14px] text-white backdrop-blur-[22px] backdrop-saturate-[1.6]">{/* theme-lint-disable — fixed dark glass on the cover photo */}
|
||||
<div className="absolute bottom-[10px] inset-x-[10px] rounded-[18px] border border-white/[.16] bg-[rgba(14,14,17,.52)] p-[12px_14px] text-white backdrop-blur-[22px] backdrop-saturate-[1.6] wide:bottom-4 wide:end-auto wide:start-4 wide:w-[min(560px,calc(100%-32px))] wide:p-[16px_18px]">{/* theme-lint-disable — fixed dark glass on the cover photo */}
|
||||
<span className="flex gap-[6px]">
|
||||
<span className="rounded-full bg-white/[.92] px-2 py-[3px] text-[0.625rem] font-bold uppercase tracking-[.07em] text-[#101013]">{/* theme-lint-disable — fixed on-photo badge */}
|
||||
{primaryBadge}
|
||||
|
||||
@@ -37,11 +37,11 @@ export default function MJourney() {
|
||||
// document and Safari's address bar stays put here.
|
||||
<div className="relative h-dvh">
|
||||
{/* Floating header: back + create pill */}
|
||||
<div className="fixed inset-x-4 top-[var(--m-safe-top,12px)] z-30 flex items-center gap-[10px]">
|
||||
<div className="m-bar-x fixed top-[var(--m-safe-top,12px)] z-30 flex items-center gap-[10px]">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => openCreateModal()}
|
||||
className="flex h-[38px] flex-1 items-center justify-center gap-[6px] whitespace-nowrap rounded-full bg-m-act px-[15px] text-[0.78125rem] font-bold text-m-actfg"
|
||||
className="flex h-[38px] flex-1 items-center justify-center gap-[6px] whitespace-nowrap rounded-full bg-m-act px-[15px] text-[0.78125rem] font-bold text-m-actfg wide:ms-auto wide:flex-none wide:px-5"
|
||||
>
|
||||
<Plus size={14} strokeWidth={2.4} />
|
||||
{t('journey.frontpage.createJourney')}
|
||||
@@ -49,7 +49,7 @@ export default function MJourney() {
|
||||
</div>
|
||||
|
||||
<MPullIndicator state={pull} label={t('common.loading')} />
|
||||
<div ref={scrollRef} className="h-full overflow-y-auto px-4 pt-[calc(var(--m-safe-top,12px)+52px)] pb-[calc(var(--bottom-nav-h,84px)+16px)]">
|
||||
<div ref={scrollRef} className="h-full overflow-y-auto px-4 pt-[calc(var(--m-safe-top,12px)+52px)] pb-[calc(var(--bottom-nav-h,84px)+16px)] wide:px-6 wide:[&>*]:mx-auto wide:[&>*]:max-w-[1040px]">
|
||||
{loading && list.length === 0 ? (
|
||||
<div className="flex justify-center py-16">
|
||||
<div className="h-6 w-6 animate-spin rounded-full border-2 border-[color:var(--m-rowbr)] border-t-m-ink" />
|
||||
@@ -72,7 +72,7 @@ export default function MJourney() {
|
||||
</span>
|
||||
<span className="h-px flex-1 bg-[color:var(--m-rowbr)]" />
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<div className="grid grid-cols-2 gap-3 split:grid-cols-3 split:gap-4">
|
||||
{rest.map(j => (
|
||||
<GridCard key={j.id} journey={j} onOpen={() => navigate(`/journey/${j.id}`)} />
|
||||
))}
|
||||
@@ -116,7 +116,7 @@ function HeroCard({ journey, onOpen }: { journey: JourneyListItem; onOpen: () =>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onOpen}
|
||||
className="relative mb-3 block h-[220px] w-full overflow-hidden rounded-[26px] text-start shadow-[0_24px_56px_-22px_rgba(0,0,0,.5)]"
|
||||
className="relative mb-3 block h-[220px] w-full overflow-hidden rounded-[26px] wide:h-[clamp(260px,38vh,420px)] text-start shadow-[0_24px_56px_-22px_rgba(0,0,0,.5)]"
|
||||
>
|
||||
{src ? (
|
||||
<img src={src} alt="" className="absolute inset-0 h-full w-full object-cover" />
|
||||
|
||||
@@ -27,6 +27,7 @@ import { useJourneyCarouselSync } from '../../../components/Journey/useJourneyCa
|
||||
import { useGalleryUpload } from '../../../components/Journey/useGalleryUpload'
|
||||
import { dayPrepText, dayPrepUnsettled } from '../../../components/Journey/journeyRecordingPrepModel'
|
||||
import MJourneyEntrySheet from './MJourneyEntrySheet'
|
||||
import { useIsWide } from '../../../hooks/sizeClass'
|
||||
import MJourneySettingsSheet from './MJourneySettingsSheet'
|
||||
import MJourneyDayImportSheet from './MJourneyDayImportSheet'
|
||||
import MJourneyRecordingSheet from './MJourneyRecordingSheet'
|
||||
@@ -41,6 +42,8 @@ import MJourneyRecordingSheet from './MJourneyRecordingSheet'
|
||||
* drops its own back button and leaves the trip's URL alone.
|
||||
*/
|
||||
export default function MJourneyDetail({ journeyId, embedded = false }: JourneyDetailOptions = {}) {
|
||||
// Larger cards on a wide window, where the strip has the room for the whole name.
|
||||
const wide = useIsWide()
|
||||
const {
|
||||
id, navigate, toast, t, locale,
|
||||
current, loading,
|
||||
@@ -299,7 +302,7 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD
|
||||
return (
|
||||
// h-dvh, not h-full: the shell stopped providing a definite height (#1809)
|
||||
// and a map on a percentage of an auto-height parent collapses to zero.
|
||||
<div className="relative h-dvh overflow-hidden">
|
||||
<div className="m-bleed relative h-dvh overflow-hidden">
|
||||
{/* Integrated map — always mounted, the gallery overlays it */}
|
||||
<div className="absolute inset-0 z-0">
|
||||
<JourneyLayeredMap
|
||||
@@ -326,7 +329,7 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD
|
||||
|
||||
{/* Gallery tab overlay */}
|
||||
{view === 'gallery' && (
|
||||
<div className="absolute inset-0 z-[5] overflow-y-auto bg-[color:var(--m-bg)] bg-[image:var(--m-scr)] px-4 pt-[calc(var(--m-safe-top,12px)+56px)] pb-[calc(var(--bottom-nav-h,84px)+16px)]">
|
||||
<div className="m-span-x absolute inset-y-0 z-[5] overflow-y-auto bg-[color:var(--m-bg)] bg-[image:var(--m-scr)] px-4 pt-[calc(var(--m-safe-top,12px)+56px)] pb-[calc(var(--bottom-nav-h,84px)+16px)] wide:px-6">
|
||||
{gallery.length === 0 ? (
|
||||
<div className="flex min-h-full flex-col items-center justify-center px-8 py-10 text-center">
|
||||
<MDancingTrek scene="journey" className="mb-2" />
|
||||
@@ -374,7 +377,7 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD
|
||||
)}
|
||||
|
||||
{/* Header: back — segment — upload / overflow menu */}
|
||||
<div className="absolute inset-x-4 top-[var(--m-safe-top,12px)] z-10 flex items-center justify-between gap-2">
|
||||
<div className="m-bar-x absolute top-[var(--m-safe-top,12px)] z-10 flex items-center justify-between gap-2">
|
||||
{embedded ? (
|
||||
<span className="w-[38px] flex-none" aria-hidden />
|
||||
) : (
|
||||
@@ -490,7 +493,7 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD
|
||||
nothing between the cards and it; two pixels keeps a hair of daylight and
|
||||
gives the strip the rest. */}
|
||||
{view === 'timeline' && entries.length > 0 && (
|
||||
<div ref={railRef} className="absolute inset-x-0 z-[8] bottom-[calc(var(--bottom-nav-h,84px)+2px)]">
|
||||
<div ref={railRef} className="m-span-x absolute z-[8] bottom-[calc(var(--bottom-nav-h,84px)+2px)]">
|
||||
<JourneyDayScrubber
|
||||
days={scrubberDays}
|
||||
activeDate={entries[activeIndex]?.entry_date ?? null}
|
||||
@@ -515,6 +518,7 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD
|
||||
showMood={current.show_mood !== 0}
|
||||
showWeather={current.show_weather !== 0}
|
||||
tone="mobile"
|
||||
size={wide ? 'large' : 'regular'}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -65,7 +65,7 @@ export default function MNotifications() {
|
||||
</MGlassBar>
|
||||
|
||||
<MPullIndicator state={pull} label={t('common.loading')} />
|
||||
<div ref={contentRef} className="px-4 pb-[calc(var(--bottom-nav-h)+24px)] pt-[calc(var(--m-safe-top,12px)+66px)]">
|
||||
<div ref={contentRef} className="px-4 pb-[calc(var(--bottom-nav-h)+24px)] pt-[calc(var(--m-safe-top,12px)+66px)] wide:mx-auto wide:max-w-[808px] wide:px-6">
|
||||
<MSegmented
|
||||
options={[
|
||||
{ value: 'all', label: t('notifications.all') },
|
||||
|
||||
@@ -27,6 +27,7 @@ import MSettingsIntegrations from './MSettingsIntegrations'
|
||||
import MSettingsAccount from './MSettingsAccount'
|
||||
import MSettingsAbout from './MSettingsAbout'
|
||||
import MSettingsServer from './MSettingsServer'
|
||||
import { useIsSplit } from '../../../hooks/sizeClass'
|
||||
|
||||
interface SectionTab {
|
||||
id: string
|
||||
@@ -45,6 +46,9 @@ export default function MSettings() {
|
||||
const navigate = useNavigate()
|
||||
const { hasIntegrations, hasPlugins, appVersion, activeTab, setActiveTab, managed } = useSettings()
|
||||
const [dropOpen, setDropOpen] = useState(false)
|
||||
// With room for two panes the sections stand in a list of their own beside
|
||||
// the page, the way Settings on an iPad does, instead of behind a dropdown.
|
||||
const split = useIsSplit()
|
||||
|
||||
const tabs: SectionTab[] = [
|
||||
{ id: 'display', label: t('settings.tabs.display'), icon: SlidersHorizontal },
|
||||
@@ -65,9 +69,42 @@ export default function MSettings() {
|
||||
|
||||
const active = tabs.find((tab) => tab.id === activeTab) || tabs[0]
|
||||
|
||||
const sectionRow = (tab: SectionTab, onPick: () => void) => (
|
||||
<button
|
||||
key={tab.id}
|
||||
type="button"
|
||||
onClick={onPick}
|
||||
aria-current={split && tab.id === active.id ? 'page' : undefined}
|
||||
className={`flex w-full items-center gap-[10px] rounded-[11px] p-[10px] text-start text-[0.8125rem] font-semibold text-m-ink outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--m-act)] ${
|
||||
tab.id === active.id ? 'bg-[color:var(--m-ic)]' : 'hover:bg-[color:var(--m-ic)]'
|
||||
}`}
|
||||
>
|
||||
<tab.icon size={15} strokeWidth={2} className="flex-none" />
|
||||
{tab.label}
|
||||
</button>
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="px-4 pb-[calc(var(--bottom-nav-h,84px)+16px)] pt-[var(--m-safe-top,12px)]">
|
||||
<div className="px-4 pb-[calc(var(--bottom-nav-h,84px)+16px)] pt-[var(--m-safe-top,12px)] wide:px-6 split:mx-auto split:grid split:max-w-[1120px] split:grid-cols-[260px_minmax(0,1fr)] split:items-start split:gap-8">
|
||||
{split && (
|
||||
<nav aria-label={t('settings.title')} className="sticky top-[var(--m-safe-top,12px)] flex flex-col gap-1 rounded-2xl border border-[color:var(--m-rowbr)] bg-[color:var(--m-sheet)] p-[6px] shadow-[0_16px_40px_-24px_rgba(0,0,0,.3)]">
|
||||
<div className="mb-1 flex items-center gap-2 p-[4px]">
|
||||
<button
|
||||
type="button"
|
||||
aria-label={t('common.back')}
|
||||
onClick={() => void navigate('/dashboard')}
|
||||
className="flex h-[34px] w-[34px] flex-none items-center justify-center rounded-full text-m-ink hover:bg-[color:var(--m-ic)]"
|
||||
>
|
||||
<ChevronLeft size={18} strokeWidth={2.2} className="rtl:-scale-x-100" />
|
||||
</button>
|
||||
<span className="min-w-0 truncate text-subtitle font-bold text-m-ink">{t('settings.title')}</span>
|
||||
</div>
|
||||
{tabs.map((tab) => sectionRow(tab, () => setActiveTab(tab.id)))}
|
||||
</nav>
|
||||
)}
|
||||
<div className="min-w-0 wide:mx-auto wide:w-full wide:max-w-[720px] split:mx-0">
|
||||
{/* Header: back + section switcher pill */}
|
||||
{!split && (
|
||||
<div className="mb-3 flex items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
@@ -88,26 +125,17 @@ export default function MSettings() {
|
||||
<ChevronDown size={13} strokeWidth={2} className="flex-none text-m-faint" />
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Section dropdown, in flow (pushes the content down like the demo) */}
|
||||
{dropOpen && (
|
||||
{dropOpen && !split && (
|
||||
<div className="m-pop-in -mt-[6px] mb-3 rounded-2xl border border-[color:var(--m-rowbr)] bg-[color:var(--m-sheetop)] p-[6px] shadow-[0_16px_40px_-20px_rgba(0,0,0,.4)]">
|
||||
{tabs.map((tab) => (
|
||||
<button
|
||||
key={tab.id}
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setActiveTab(tab.id)
|
||||
setDropOpen(false)
|
||||
}}
|
||||
className={`flex w-full items-center gap-[10px] rounded-[11px] p-[10px] text-start text-[0.8125rem] font-semibold text-m-ink ${
|
||||
tab.id === active.id ? 'bg-[color:var(--m-ic)]' : ''
|
||||
}`}
|
||||
>
|
||||
<tab.icon size={15} strokeWidth={2} className="flex-none" />
|
||||
{tab.label}
|
||||
</button>
|
||||
))}
|
||||
{tabs.map((tab) =>
|
||||
sectionRow(tab, () => {
|
||||
setActiveTab(tab.id)
|
||||
setDropOpen(false)
|
||||
}),
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -135,6 +163,7 @@ export default function MSettings() {
|
||||
</a>
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import { MoreHorizontal } from 'lucide-react';
|
||||
import type { ComponentType } from 'react';
|
||||
import { useTranslation } from '../../../i18n';
|
||||
import { MRail, MRailButton, MRailSpacer } from '../../components/MRail';
|
||||
import { DOCK_PRIORITY } from './dockTabs';
|
||||
|
||||
interface RailTab {
|
||||
id: string;
|
||||
icon?: ComponentType<{ size?: number; strokeWidth?: number; className?: string }> | null;
|
||||
}
|
||||
|
||||
interface MTripRailProps {
|
||||
/** The trip's sections the phone shows (dock and More grid together). */
|
||||
tabs: RailTab[];
|
||||
active: string;
|
||||
onSelect: (id: string) => void;
|
||||
/** Opens the More sheet: trip settings, export, the assistant. */
|
||||
onMore: () => void;
|
||||
labelOf: (id: string) => string;
|
||||
}
|
||||
|
||||
const DOCK_ICONS = new Map(DOCK_PRIORITY.map((tab) => [tab.id, tab.icon]));
|
||||
|
||||
/**
|
||||
* The trip's sections on a wide window, in place of the phone's dock. The dock
|
||||
* has seats for five; the rail has room for every section, so files,
|
||||
* collaboration and plugin pages sit in it too, each with its name, and More
|
||||
* keeps only the trip's actions.
|
||||
*/
|
||||
export default function MTripRail({ tabs, active, onSelect, onMore, labelOf }: MTripRailProps) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<MRail label={t('mobileTrip.sections')}>
|
||||
{tabs.map((tab) => {
|
||||
const Icon = DOCK_ICONS.get(tab.id) ?? tab.icon;
|
||||
const on = tab.id === active;
|
||||
return (
|
||||
<MRailButton key={tab.id} label={labelOf(tab.id)} active={on} onClick={() => onSelect(tab.id)}>
|
||||
{Icon && <Icon size={20} strokeWidth={on ? 2.1 : 1.9} />}
|
||||
</MRailButton>
|
||||
);
|
||||
})}
|
||||
<MRailSpacer />
|
||||
<MRailButton label={t('mobileTrip.more')} active={false} onClick={onMore}>
|
||||
<MoreHorizontal size={20} strokeWidth={2.2} />
|
||||
</MRailButton>
|
||||
</MRail>
|
||||
);
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import { useEffect, useLayoutEffect, useRef, useState, type ComponentType, type
|
||||
import { findFocusDayId, findTodayDayId } from '../../../components/Planner/today'
|
||||
import { takeResumeDay } from '../../../utils/resumeRoute'
|
||||
import {
|
||||
CalendarDays, ChevronDown, ChevronLeft, Download, FileDown, FolderSync, List, Map as MapIcon, MoreHorizontal, Plane, Plus, Route, Rows3, SlidersHorizontal, Trash2, Upload,
|
||||
CalendarDays, ChevronDown, ChevronLeft, Download, FileDown, List, Map as MapIcon, MoreHorizontal, PanelLeftClose, PanelLeftOpen, Plane, Plus, Route, SlidersHorizontal, Trash2, Upload,
|
||||
} from 'lucide-react'
|
||||
import { useTripPlanner } from '../../../pages/tripPlanner/useTripPlanner'
|
||||
import { pickDockTabs } from './dockTabs'
|
||||
@@ -22,13 +22,15 @@ import { stageOf } from '../../../components/Roadtrip/roadtripRowModel'
|
||||
import { badgeLabel, distanceBadge } from './roadtrip/stageBadges'
|
||||
import type { CorridorReach } from '../../../components/Roadtrip/corridorSearchModel'
|
||||
import { useSettingsStore } from '../../../store/settingsStore'
|
||||
import { useAuthStore } from '../../../store/authStore'
|
||||
import { useListsSubTab, type ListsSubTab } from '../../../hooks/useListsSubTab'
|
||||
import { canManageDocSync } from '../../../components/Files/docsync/useDocSync'
|
||||
import { useDocSyncOffered } from '../../../components/Files/docsync/useDocSyncOffered'
|
||||
import type { Day, Trip } from '../../../types'
|
||||
import type { Day } from '../../../types'
|
||||
import { getIntlLanguage } from '@trek/shared'
|
||||
import { useDayPreviewStore } from '../../dayPreviewStore'
|
||||
import { useIsSplit, useIsWide } from '../../../hooks/sizeClass'
|
||||
import MTripRail from './MTripRail'
|
||||
import { CompactToggle, DocSyncButton, GlassSegment } from './MTripShellParts'
|
||||
import { edgeFadeClass, useEdgeFade } from '../../components/useEdgeFade'
|
||||
import { useShortcuts } from '../../keyboard/useShortcuts'
|
||||
|
||||
/**
|
||||
* Mobile trip screen frame. Owns the chrome the design shares across every
|
||||
@@ -97,6 +99,11 @@ export interface MTripShellApi {
|
||||
*/
|
||||
rtReach: CorridorReach
|
||||
setRtReach: (value: CorridorReach) => void
|
||||
/**
|
||||
* True while the trip's pane stands beside the map (split size class): the map
|
||||
* then has no chrome over it, so its own controls move up to the top edge.
|
||||
*/
|
||||
paneOpen: boolean
|
||||
/** Travel/Plan/Places segment: go | edit | browse. */
|
||||
mode: MTripMode
|
||||
/** Legacy tab ids: plan · transports · buchungen · listen · finanzplan · dateien · collab · plugin:* */
|
||||
@@ -234,6 +241,11 @@ export default function MTripShell({
|
||||
const [uploadFilesSignal, setUploadFilesSignal] = useState(0)
|
||||
const [openFilesTrashSignal, setOpenFilesTrashSignal] = useState(0)
|
||||
const [openDocSyncSignal, setOpenDocSyncSignal] = useState(0)
|
||||
// Size class (hooks/sizeClass.ts). Wide: a rail on the leading edge holds the
|
||||
// trip's sections instead of the dock. Split: the plan, the places or the
|
||||
// road trip's chain sit in a pane beside the map rather than over it.
|
||||
const wide = useIsWide()
|
||||
const split = useIsSplit()
|
||||
|
||||
// The mobile plan is single-day: make sure a day is active once days arrive.
|
||||
// Only seed once so an intentional deselect elsewhere is not fought. Open on
|
||||
@@ -306,6 +318,8 @@ export default function MTripShell({
|
||||
setBookingImportKind('bookings')
|
||||
setShowBookingImport(true)
|
||||
}, [sharedTripId, tripId, setBookingImportKind, setShowBookingImport])
|
||||
// The day strip says when it runs on past an edge (a long trip, a narrow pane).
|
||||
const dayFade = useEdgeFade(dayRail)
|
||||
const dayPill = useActivePill(dayRail, '[aria-current="true"]', `${railDayId}:${days.map(d => d.id).join(',')}:${language}`)
|
||||
|
||||
const trTab = planner.activeTab
|
||||
@@ -379,8 +393,9 @@ export default function MTripShell({
|
||||
focusMapOnDay(planner.selectedDayId)
|
||||
} else {
|
||||
// Leaving the map: nothing is filtered while the timeline is up, so the next
|
||||
// visit starts from the whole trip unless a day is picked again.
|
||||
focusMapOnDay(null)
|
||||
// visit starts from the whole trip unless a day is picked again. Beside the
|
||||
// pane the map stays in view, so there it keeps showing the day.
|
||||
if (!split) focusMapOnDay(null)
|
||||
// The timeline is single-day and renders empty without one, so an "all days"
|
||||
// deselect on the map must not follow the user back into the plan. Same day
|
||||
// the toggle would restore, so the two ways back agree.
|
||||
@@ -407,13 +422,56 @@ export default function MTripShell({
|
||||
})
|
||||
}
|
||||
|
||||
const mapFront = (trTab === 'plan' && view === 'map') || (trTab === 'roadtrip' && rtView === 'map')
|
||||
// Beside a pane the map is on screen in both halves, so whatever floats over
|
||||
// it (POI pill, compass, the all-days switch) stays, and "show on map" has
|
||||
// nowhere to switch to.
|
||||
const mapFront = (trTab === 'plan' && (view === 'map' || split)) || (trTab === 'roadtrip' && (rtView === 'map' || split))
|
||||
// The pane is open while the plan tab shows its timeline or the places, or the
|
||||
// road trip tab its chain. The list/map switch closes it for the whole map.
|
||||
const paneOpen = split && ((trTab === 'plan' && (view === 'plan' || mode === 'browse')) || (trTab === 'roadtrip' && rtView === 'list'))
|
||||
|
||||
// With the plan beside the map, the map shows the day the plan shows: its
|
||||
// places framed, its route drawn, the other days' pins put away, exactly as
|
||||
// a phone does when it switches over to the map.
|
||||
const followDayId = split && trTab === 'plan' && view === 'plan' && mode !== 'browse' ? planner.selectedDayId : null
|
||||
const { autoShowRoute, setExpandedDayIds } = planner
|
||||
useEffect(() => {
|
||||
if (followDayId == null) return
|
||||
autoShowRoute()
|
||||
setExpandedDayIds(new Set([followDayId]))
|
||||
}, [followDayId, autoShowRoute, setExpandedDayIds])
|
||||
|
||||
const openSheet = (id: string, payload?: unknown) => setSheet({ id, payload })
|
||||
const closeSheet = () => setSheet(null)
|
||||
|
||||
// A hardware keyboard: ⌘1 to ⌘9 for the trip's sections in rail order, ⌥← and
|
||||
// ⌥→ through the days, ⌃⌘S for the pane beside the map (as Show Sidebar does
|
||||
// in every iPad app), ⌘[ back to the trips.
|
||||
const keyTabs = planner.TRIP_TABS.filter(tab => !tab.desktopOnly).slice(0, 9)
|
||||
const stepDay = (delta: number) => {
|
||||
const at = days.findIndex(d => d.id === planner.selectedDayId)
|
||||
const next = days[at + delta]
|
||||
if (at === -1 || !next) return
|
||||
if (mapFront && !split) selectDayOnMap(next.id)
|
||||
else planner.handleSelectDay(next.id, true)
|
||||
}
|
||||
const dayKeys = trTab === 'plan' || trTab === 'roadtrip'
|
||||
useShortcuts('trip', [
|
||||
...keyTabs.map((tab, i) => ({ id: `tab-${tab.id}`, title: tab.label, key: String(i + 1), mod: true, run: () => setTrTab(tab.id) })),
|
||||
...(dayKeys && days.length > 1
|
||||
? [
|
||||
{ id: 'day-prev', title: t('mobileTrip.previousDay'), key: 'ArrowLeft', alt: true, run: () => stepDay(-1) },
|
||||
{ id: 'day-next', title: t('mobileTrip.nextDay'), key: 'ArrowRight', alt: true, run: () => stepDay(1) },
|
||||
]
|
||||
: []),
|
||||
...(split && MAP_TABS.has(trTab)
|
||||
? [{ id: 'pane', title: paneOpen ? t('mobileTrip.hidePane') : t('mobileTrip.showPane'), key: 's', ctrl: true, run: trTab === 'roadtrip' ? toggleRtView : toggleView }]
|
||||
: []),
|
||||
{ id: 'back', title: t('common.back'), key: '[', mod: true, run: () => void navigate('/dashboard') },
|
||||
])
|
||||
|
||||
const shell: MTripShellApi = {
|
||||
view, rtView, mapFront, toggleRtView, rtReach, setRtReach, mode, trTab, setTrTab, setTravelMode, toggleView, browseFromEdit,
|
||||
view, rtView, mapFront, paneOpen, toggleRtView, rtReach, setRtReach, mode, trTab, setTrTab, setTravelMode, toggleView, browseFromEdit,
|
||||
sheet, openSheet, closeSheet,
|
||||
listsTab, setListsTab, collabTab, setCollabTab,
|
||||
transportsCompact, bookingsCompact,
|
||||
@@ -437,6 +495,9 @@ export default function MTripShell({
|
||||
// Null outside the trip's dates.
|
||||
const todayDayId = findTodayDayId(days)
|
||||
|
||||
// Beside a pane the switch shows or hides the pane, the way a sidebar button does.
|
||||
const splitToggleLabel = split ? (paneOpen ? t('mobileTrip.hidePane') : t('mobileTrip.showPane')) : null
|
||||
|
||||
const onDayChipTap = (dayId: number) => {
|
||||
if (dayId === planner.selectedDayId) openSheet('day', { dayId })
|
||||
// In map mode a day tap fits to that day's places, draws its route and drops
|
||||
@@ -465,8 +526,26 @@ export default function MTripShell({
|
||||
)
|
||||
const rtHeaderLabel = badgeLabel([rtHeaderDay, rtHeaderDistance])
|
||||
|
||||
// The chrome over the content (top controls, day chips) spans the pane while
|
||||
// one is open, otherwise the page column after the rail.
|
||||
const chromeSpan = paneOpen ? 'split:end-auto split:w-[calc(var(--trip-pane)-32px)]' : ''
|
||||
const paneBox = 'absolute inset-y-0 start-0 end-0 wide:start-[var(--m-rail-w)] split:end-auto split:w-[var(--trip-pane)]'
|
||||
// Where the map begins. Beside an open pane, after it; while the map is the
|
||||
// whole screen it runs under the floating rail to the window's edge, with its
|
||||
// controls kept clear of the rail (--trip-map-inset); behind a full-width
|
||||
// list it waits after the rail, out of sight.
|
||||
const mapUnderRail = wide && mapFront && !paneOpen
|
||||
const mapStart = paneOpen ? 'calc(var(--m-rail-w) + var(--trip-pane-open))' : mapUnderRail ? '0px' : 'var(--m-rail-w)'
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-50 overflow-hidden bg-[color:var(--m-bg)] bg-[image:var(--m-scr)] text-m-ink">
|
||||
<div
|
||||
className="m-trip fixed inset-0 z-50 overflow-hidden bg-[color:var(--m-bg)] bg-[image:var(--m-scr)] text-m-ink"
|
||||
style={{
|
||||
['--trip-pane' as string]: paneOpen ? 'var(--trip-pane-open)' : '0px',
|
||||
['--trip-map-start' as string]: mapStart,
|
||||
['--trip-map-inset' as string]: mapUnderRail ? 'var(--m-rail-w)' : '0px',
|
||||
}}
|
||||
>
|
||||
{/* ── Content layers ─────────────────────────────────────────────── */}
|
||||
{/*
|
||||
One expression for both map tabs, and it has to stay one: written as two
|
||||
@@ -477,14 +556,18 @@ export default function MTripShell({
|
||||
*/}
|
||||
{MAP_TABS.has(trTab) && (
|
||||
<div className="absolute inset-0">
|
||||
<MapArea planner={planner} shell={shell} />
|
||||
{/* The map's own box ends where the pane begins, so its controls and the
|
||||
framing of a day stay in the part of it that can be seen. */}
|
||||
<div className="absolute inset-y-0 end-0 start-[var(--trip-map-start)] transition-[inset-inline-start] duration-300 ease-out motion-reduce:transition-none">
|
||||
<MapArea planner={planner} shell={shell} />
|
||||
</div>
|
||||
{trTab === 'plan' && view === 'plan' && mode !== 'browse' && (
|
||||
<div className="absolute inset-0 z-10 bg-[color:var(--m-bg)] bg-[image:var(--m-scr)]">
|
||||
<div className={`${paneBox} z-10 bg-[color:var(--m-bg)] bg-[image:var(--m-scr)] split:border-e split:border-[color:var(--m-rowbr)]`}>
|
||||
<PlanTimeline planner={planner} shell={shell} />
|
||||
</div>
|
||||
)}
|
||||
{trTab === 'plan' && mode === 'browse' && (
|
||||
<div className="absolute inset-0 z-30 bg-[color:var(--m-bg)] bg-[image:var(--m-scr)]">
|
||||
<div className={`${paneBox} z-30 bg-[color:var(--m-bg)] bg-[image:var(--m-scr)] split:border-e split:border-[color:var(--m-rowbr)]`}>
|
||||
<PlacesBrowser planner={planner} shell={shell} />
|
||||
</div>
|
||||
)}
|
||||
@@ -494,29 +577,35 @@ export default function MTripShell({
|
||||
hidden because non-plan panels cover them at z-30.
|
||||
*/}
|
||||
{trTab === 'roadtrip' && rtView === 'list' && (
|
||||
<div className="absolute inset-0 z-20 bg-[color:var(--m-bg)] bg-[image:var(--m-scr)]">
|
||||
<div className={`${paneBox} z-20 bg-[color:var(--m-bg)] bg-[image:var(--m-scr)] split:border-e split:border-[color:var(--m-rowbr)]`}>
|
||||
<TabPanel planner={planner} shell={shell} tab={trTab} />
|
||||
</div>
|
||||
)}
|
||||
{trTab === 'roadtrip' && rtView === 'map' && (
|
||||
<TabPanel planner={planner} shell={shell} tab={trTab} />
|
||||
// The stage's bars keep to the page column while the map runs under the rail.
|
||||
<div className="pointer-events-none absolute inset-0 wide:start-[var(--m-rail-w)]">
|
||||
<TabPanel planner={planner} shell={shell} tab={trTab} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{!MAP_TABS.has(trTab) && (
|
||||
<div className="absolute inset-0 z-30 bg-[color:var(--m-bg)] bg-[image:var(--m-scr)]">
|
||||
<div className="absolute inset-0 z-30 bg-[color:var(--m-bg)] bg-[image:var(--m-scr)] wide:start-[var(--m-rail-w)]">
|
||||
<TabPanel planner={planner} shell={shell} tab={trTab} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ── Day chips (z-25 — covered by non-plan tab overlays, stays mounted) ── */}
|
||||
{days.length > 0 && (
|
||||
<div className="absolute inset-x-4 z-[25] flex gap-[6px] top-[calc(var(--m-safe-top,12px)+50px)]">
|
||||
<div ref={setDayRail} className="relative flex flex-1 items-center gap-[2px] overflow-x-auto rounded-full border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] p-[3px] backdrop-blur-[24px] backdrop-saturate-[1.7]">
|
||||
<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)}`}>
|
||||
{dayPill && (
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="pointer-events-none absolute bottom-[3px] left-0 top-[3px] rounded-full bg-m-act shadow-[0_6px_16px_-6px_rgba(0,0,0,.4)]" // rtl-lint-disable: moved by the measured offsetLeft (useActivePill)
|
||||
className="pointer-events-none absolute bottom-0 left-0 top-0 rounded-full bg-m-act shadow-[0_6px_16px_-6px_rgba(0,0,0,.4)]" // rtl-lint-disable: moved by the measured offsetLeft (useActivePill)
|
||||
style={dayPill}
|
||||
/>
|
||||
)}
|
||||
@@ -553,6 +642,7 @@ export default function MTripShell({
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
{/* Drop the day filter and show the whole trip (#2257). Map only: the
|
||||
plan timeline and the road trip chain are both single-day, so there is
|
||||
nothing to widen there. Stays mounted while a day is active rather than
|
||||
@@ -578,7 +668,7 @@ export default function MTripShell({
|
||||
)}
|
||||
|
||||
{/* ── Top controls (z-42 — above every layer incl. tab overlays) ── */}
|
||||
<div className="absolute inset-x-4 z-[42] flex h-10 items-center justify-between top-[var(--m-safe-top,12px)]">
|
||||
<div className={`absolute end-4 start-[calc(var(--m-rail-w,0px)+16px)] z-[42] flex h-10 items-center justify-between top-[var(--m-safe-top,12px)] ${chromeSpan}`}>
|
||||
<MIconBtn ariaLabel={t('common.back')} onClick={() => navigate('/dashboard')} className="backdrop-blur-[24px] backdrop-saturate-[1.7]">
|
||||
<ChevronLeft size={19} strokeWidth={2.2} />
|
||||
</MIconBtn>
|
||||
@@ -763,19 +853,32 @@ export default function MTripShell({
|
||||
states: coupling them would drag one tab into the other's half. */}
|
||||
{MAP_TABS.has(trTab) ? (
|
||||
<MIconBtn
|
||||
ariaLabel={mapFront ? t('mobileTrip.listView') : t('mobileTrip.mapView')}
|
||||
ariaLabel={splitToggleLabel ?? (mapFront ? t('mobileTrip.listView') : t('mobileTrip.mapView'))}
|
||||
onClick={trTab === 'roadtrip' ? toggleRtView : toggleView}
|
||||
className="backdrop-blur-[24px] backdrop-saturate-[1.7]"
|
||||
>
|
||||
{mapFront ? <List size={18} strokeWidth={2} /> : <MapIcon size={18} strokeWidth={2} />}
|
||||
{split
|
||||
? (paneOpen ? <PanelLeftClose size={18} strokeWidth={2} className="rtl:-scale-x-100" /> : <PanelLeftOpen size={18} strokeWidth={2} className="rtl:-scale-x-100" />)
|
||||
: mapFront ? <List size={18} strokeWidth={2} /> : <MapIcon size={18} strokeWidth={2} />}
|
||||
</MIconBtn>
|
||||
) : (
|
||||
<span className="w-[38px] flex-none" />
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* ── Section rail on a wide window, where an iPad keeps its sidebar ── */}
|
||||
{wide && (
|
||||
<MTripRail
|
||||
tabs={mobileTabs}
|
||||
active={trTab}
|
||||
onSelect={setTrTab}
|
||||
onMore={() => openSheet('mehr')}
|
||||
labelOf={tabLabel}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* ── Bottom dock (replaces the global bottom nav on this screen) ── */}
|
||||
<nav className="absolute inset-x-4 z-40 flex h-[62px] items-center justify-around rounded-[31px] border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] px-[14px] shadow-[0_16px_44px_-14px_rgba(0,0,0,.35)] backdrop-blur-[30px] backdrop-saturate-[1.8] bottom-[calc(env(safe-area-inset-bottom,0px)+12px)]">
|
||||
{!wide && <nav className="absolute inset-x-4 z-40 flex h-[62px] items-center justify-around rounded-[31px] border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] px-[14px] shadow-[0_16px_44px_-14px_rgba(0,0,0,.35)] backdrop-blur-[30px] backdrop-saturate-[1.8] bottom-[calc(env(safe-area-inset-bottom,0px)+12px)]">
|
||||
{dockTabs.map(({ id, icon: Icon }) => {
|
||||
const active = trTab === id
|
||||
return (
|
||||
@@ -801,22 +904,13 @@ export default function MTripShell({
|
||||
>
|
||||
<MoreHorizontal size={19} strokeWidth={2.2} />
|
||||
</button>
|
||||
</nav>
|
||||
</nav>}
|
||||
|
||||
<Sheets planner={planner} shell={shell} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/** Centre glass pill of the top controls (segments for plan/lists/collab). */
|
||||
function GlassSegment({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<div className="absolute left-1/2 top-1/2 flex -translate-x-1/2 -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>
|
||||
)
|
||||
}
|
||||
|
||||
/** Primary header action (Add transport / New reservation / Add expense / Upload). */
|
||||
function PrimaryPill({ label, onClick, icon }: { label: string; onClick: () => void; icon?: ReactNode }) {
|
||||
return (
|
||||
@@ -830,39 +924,3 @@ function PrimaryPill({ label, onClick, icon }: { label: string; onClick: () => v
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* The Files header's sync button, only where there is something behind it.
|
||||
*
|
||||
* A component of its own so the question is asked while the Files header is
|
||||
* up, not on every tab the shell renders.
|
||||
*/
|
||||
function DocSyncButton({ tripId, trip, label, onOpen }: { tripId: number; trip: Trip; label: string; onOpen: () => void }) {
|
||||
const user = useAuthStore(s => s.user)
|
||||
const offered = useDocSyncOffered(tripId, canManageDocSync(user, trip))
|
||||
if (!offered) return null
|
||||
return (
|
||||
<MIconBtn ariaLabel={label} onClick={onOpen} size={40} className="text-m-muted backdrop-blur-[24px] backdrop-saturate-[1.7]">
|
||||
<FolderSync size={15} strokeWidth={2} />
|
||||
</MIconBtn>
|
||||
)
|
||||
}
|
||||
|
||||
/** 40px list-density toggle on the transports/bookings headers. */
|
||||
function CompactToggle({ active, onToggle, label }: { active: boolean; onToggle: () => void; label: string }) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onToggle}
|
||||
aria-label={label}
|
||||
aria-pressed={active}
|
||||
className={`flex h-10 w-10 flex-none items-center justify-center rounded-full border ${
|
||||
active
|
||||
? 'border-[color:var(--m-act)] bg-m-act text-m-actfg'
|
||||
: 'border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] text-m-muted backdrop-blur-[24px] backdrop-saturate-[1.7]'
|
||||
}`}
|
||||
>
|
||||
{active ? <Rows3 size={15} strokeWidth={2} /> : <List size={15} strokeWidth={2} />}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import { FolderSync, List, Rows3 } from 'lucide-react';
|
||||
import type { ReactNode } from 'react';
|
||||
import { canManageDocSync } from '../../../components/Files/docsync/useDocSync';
|
||||
import { useDocSyncOffered } from '../../../components/Files/docsync/useDocSyncOffered';
|
||||
import { useAuthStore } from '../../../store/authStore';
|
||||
import type { Trip } from '../../../types';
|
||||
import MIconBtn from '../../components/MIconBtn';
|
||||
|
||||
// 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 }) {
|
||||
return (
|
||||
<div className="absolute left-1/2 top-1/2 flex -translate-x-1/2 -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>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The Files header's sync button, only where there is something behind it.
|
||||
*
|
||||
* A component of its own so the question is asked while the Files header is
|
||||
* up, not on every tab the shell renders.
|
||||
*/
|
||||
export function DocSyncButton({
|
||||
tripId,
|
||||
trip,
|
||||
label,
|
||||
onOpen,
|
||||
}: {
|
||||
tripId: number;
|
||||
trip: Trip;
|
||||
label: string;
|
||||
onOpen: () => void;
|
||||
}) {
|
||||
const user = useAuthStore((s) => s.user);
|
||||
const offered = useDocSyncOffered(tripId, canManageDocSync(user, trip));
|
||||
if (!offered) return null;
|
||||
return (
|
||||
<MIconBtn
|
||||
ariaLabel={label}
|
||||
onClick={onOpen}
|
||||
size={40}
|
||||
className="text-m-muted backdrop-blur-[24px] backdrop-saturate-[1.7]"
|
||||
>
|
||||
<FolderSync size={15} strokeWidth={2} />
|
||||
</MIconBtn>
|
||||
);
|
||||
}
|
||||
|
||||
/** 40px list-density toggle on the transports/bookings headers. */
|
||||
export function CompactToggle({ active, onToggle, label }: { active: boolean; onToggle: () => void; label: string }) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onToggle}
|
||||
aria-label={label}
|
||||
aria-pressed={active}
|
||||
className={`flex h-10 w-10 flex-none items-center justify-center rounded-full border ${
|
||||
active
|
||||
? 'border-[color:var(--m-act)] bg-m-act text-m-actfg'
|
||||
: 'border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] text-m-muted backdrop-blur-[24px] backdrop-saturate-[1.7]'
|
||||
}`}
|
||||
>
|
||||
{active ? <Rows3 size={15} strokeWidth={2} /> : <List size={15} strokeWidth={2} />}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -440,7 +440,13 @@ export default function MMapArea({ planner, shell }: MMapAreaProps) {
|
||||
takes the full width between the screen margins, so its segments are
|
||||
the same size as everything else the thumb aims at on this screen. */}
|
||||
{mapActive && !onStage && poiPillEnabled && (
|
||||
<div className="pointer-events-none absolute inset-x-4 z-[25] flex flex-col items-center gap-2 top-[calc(var(--m-safe-top,12px)+96px)]">
|
||||
<div
|
||||
// Beside the trip's pane nothing lies over the map, so the bar takes the
|
||||
// top edge, level with the pane's own top row.
|
||||
className={`pointer-events-none absolute end-4 start-[calc(var(--trip-map-inset,0px)+16px)] z-[25] flex flex-col items-center gap-2 ${
|
||||
shell.paneOpen ? 'top-[var(--m-safe-top,12px)]' : 'top-[calc(var(--m-safe-top,12px)+96px)]'
|
||||
}`}
|
||||
>
|
||||
<PoiCategoryPill
|
||||
fullWidth
|
||||
phoneChrome
|
||||
@@ -463,7 +469,7 @@ export default function MMapArea({ planner, shell }: MMapAreaProps) {
|
||||
{mapActive && (glMap || planner.dawarichEnabled) && (
|
||||
<div
|
||||
className="pointer-events-none absolute z-[25] flex flex-col-reverse items-start gap-2"
|
||||
style={{ left: COMPASS_LEFT, bottom: `calc(var(--bottom-nav-h, 84px) + ${12 + COMPASS_RAISE}px)` }}
|
||||
style={{ left: COMPASS_LEFT, marginInlineStart: 'var(--trip-map-inset, 0px)', bottom: `calc(var(--bottom-nav-h, 84px) + ${12 + COMPASS_RAISE}px)` }}
|
||||
>
|
||||
{/* Kept in road-trip mode: the recorded route beside the planned one is
|
||||
exactly the comparison a drive invites. */}
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { LucideIcon } from 'lucide-react'
|
||||
import MSheet from '../../../components/MSheet'
|
||||
import type { MTripSheetsProps } from '../MTripShell'
|
||||
import { dockTabIds } from '../dockTabs'
|
||||
import { useIsWide } from '../../../../hooks/sizeClass'
|
||||
import { useTranslation } from '../../../../i18n'
|
||||
import { useAssistantAsk } from '../../../../components/Assistant/useAssistantAsk'
|
||||
import { useAssistantHints } from '../../../../components/Assistant/useAssistantHints'
|
||||
@@ -35,7 +36,10 @@ export default function MMehrSheet({ planner, shell }: MTripSheetsProps) {
|
||||
// Derived from the same priority list the dock seats itself from, so a section
|
||||
// can never show up in both places at once.
|
||||
const mobileTabs = planner.TRIP_TABS.filter(tab => !tab.desktopOnly)
|
||||
const seated = dockTabIds(new Set(mobileTabs.map(tab => tab.id)))
|
||||
// On a wide window every section has its place in the rail (MTripRail), so
|
||||
// the sheet keeps only the trip's actions.
|
||||
const wide = useIsWide()
|
||||
const seated = wide ? new Set(mobileTabs.map(tab => tab.id)) : dockTabIds(new Set(mobileTabs.map(tab => tab.id)))
|
||||
const gridTabs = mobileTabs.filter(tab => !seated.has(tab.id))
|
||||
|
||||
const tileStat = (id: string): string | null => {
|
||||
@@ -62,7 +66,7 @@ export default function MMehrSheet({ planner, shell }: MTripSheetsProps) {
|
||||
]
|
||||
|
||||
return (
|
||||
<MSheet open={open} onClose={shell.closeSheet} variant="bottom" dimTransparent ariaLabel={t('mobileTrip.more')}>
|
||||
<MSheet open={open} onClose={shell.closeSheet} variant="bottom" dimTransparent wideWidth="compact" wideAnchor="rail-foot" ariaLabel={t('mobileTrip.more')}>
|
||||
<div className="overflow-y-auto p-[10px]">
|
||||
{/* The assistant leads the sheet: the one way into it on the phone besides "Ask" on a place. */}
|
||||
{assistant.available && (
|
||||
|
||||
@@ -77,7 +77,7 @@ export default function MCollabChat({ planner }: MCollabChatProps) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-col px-4 pb-[var(--bottom-nav-h,84px)] pt-[calc(var(--m-safe-top,12px)+58px)]">
|
||||
<div className="flex h-full flex-col px-4 pb-[var(--bottom-nav-h,84px)] pt-[calc(var(--m-safe-top,12px)+58px)] wide:mx-auto wide:w-full wide:max-w-[808px] wide:px-6 wide:pb-[calc(var(--bottom-nav-h,0px)+12px)]">
|
||||
{loading ? (
|
||||
<div className="flex flex-1 items-center justify-center">
|
||||
<Loader2 size={22} strokeWidth={2} className="animate-spin text-m-faint" />
|
||||
|
||||
@@ -322,7 +322,7 @@ export default function MCostsTab({ planner, shell }: MTabScreenProps) {
|
||||
onChange={e => setSearch(e.target.value)}
|
||||
placeholder={t('costs.searchPlaceholder')}
|
||||
aria-label={t('costs.searchPlaceholder')}
|
||||
className="mt-2 w-full rounded-full border border-[color:var(--m-rowbr)] bg-m-card px-[13px] py-[10px] font-[inherit] text-[0.8125rem] font-medium text-m-ink outline-none placeholder:text-m-faint"
|
||||
className="mt-2 block w-full rounded-full border border-[color:var(--m-rowbr)] bg-m-card px-[13px] py-[10px] font-[inherit] text-[0.8125rem] font-medium text-m-ink outline-none placeholder:text-m-faint"
|
||||
/>
|
||||
<div className="mt-2 flex rounded-full bg-m-card p-[3px]">
|
||||
{(['all', 'mine', 'owed'] as const).map(seg => (
|
||||
|
||||
@@ -14,10 +14,17 @@ import { useReservationDetailPlugins } from '../../../../components/Planner/book
|
||||
* the floating controls, the bottom clears the dock via --bottom-nav-h. (Collab
|
||||
* lays out its own column so its composer can sit just above the dock.)
|
||||
*/
|
||||
export function TabScroller({ children }: { children: ReactNode }) {
|
||||
export function TabScroller({ children, wide = 'readable' }: { children: ReactNode; wide?: 'readable' | 'full' }) {
|
||||
// On a wide window the list keeps a readable measure in the middle of the
|
||||
// page, as iPadOS lists do, while the scroller itself still spans the page so
|
||||
// a scroll anywhere on it moves the list. A grid (files) takes the page.
|
||||
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)]">
|
||||
<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)] wide:px-6 ${
|
||||
wide === 'readable' ? 'wide:[&>*]:mx-auto wide:[&>*]:max-w-[760px]' : ''
|
||||
}`}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -192,7 +192,7 @@ export default function MVacay() {
|
||||
onSelectDay={v.selectYear}
|
||||
describeDay={i => String(v.years[i] ?? '')}
|
||||
renderDay={pageYear => (
|
||||
<div className="grid grid-cols-2 gap-[10px]">
|
||||
<div className="grid grid-cols-2 gap-[10px] wide:grid-cols-3 split:grid-cols-4">
|
||||
{/* Twelve months from the window start (#737) — Jan–Dec on a calendar
|
||||
year, Jul–Jun once the leave year is shifted. */}
|
||||
{v.monthsFor(pageYear ?? v.selectedYear).map(({ year, month }, slot) => (
|
||||
@@ -277,7 +277,7 @@ export default function MVacay() {
|
||||
|
||||
{/* Mode switch (edit only) */}
|
||||
{edit && v.selectedUser && (
|
||||
<div className="fixed inset-x-0 z-[30] flex justify-center bottom-[calc(var(--bottom-nav-h,84px)+2px)]">
|
||||
<div className="m-span-x fixed z-[30] flex justify-center bottom-[calc(var(--bottom-nav-h,84px)+2px)] wide:bottom-[calc(env(safe-area-inset-bottom,0px)+84px)]">
|
||||
<div className="flex items-center gap-[5px] rounded-full border border-[color:var(--m-shbr)] bg-[color:var(--m-sheet)] p-[5px] shadow-[0_12px_30px_-12px_rgba(0,0,0,.4)]">
|
||||
<button
|
||||
type="button"
|
||||
@@ -347,7 +347,7 @@ export default function MVacay() {
|
||||
type="button"
|
||||
onClick={v.toggleView}
|
||||
aria-label={edit ? t('mobileVacay.viewYear') : t('mobileVacay.editCalendar')}
|
||||
className={`fixed left-1/2 z-50 flex h-14 w-14 -translate-x-1/2 items-center justify-center rounded-full transition-[background,color] duration-300 ease-in-out bottom-[calc(env(safe-area-inset-bottom,0px)+15px)] ${
|
||||
className={`fixed start-[calc(50%+var(--m-rail-w,0px)/2-28px)] z-50 flex h-14 w-14 items-center justify-center rounded-full transition-[background,color] duration-300 ease-in-out bottom-[calc(env(safe-area-inset-bottom,0px)+15px)] ${
|
||||
edit
|
||||
? 'border-2 border-[color:var(--m-act)] bg-[color:var(--m-sheetop)] text-m-ink'
|
||||
: 'bg-m-act text-m-actfg shadow-[0_8px_20px_-6px_rgba(0,0,0,.4)]'
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { isNativeApp } from '../native/platform'
|
||||
|
||||
/**
|
||||
* The phone shell's viewport: narrower than the md breakpoint (768px), or a
|
||||
@@ -12,11 +13,20 @@ import { useState, useEffect } from 'react'
|
||||
* fine.
|
||||
*
|
||||
* The phone rules in `index.css` repeat this query; keep them in step.
|
||||
*
|
||||
* The app is the exception: inside it the phone shell applies at every size.
|
||||
* An iPad, an iPad in Split View or Stage Manager and a foldable unfolded all
|
||||
* get the touch shell, laid out for their width (see `hooks/sizeClass.ts`), never
|
||||
* the desktop pages. Only that keeps one route tree across a fold, a
|
||||
* rotation or a window resize, so nothing open or typed is lost, and only the
|
||||
* touch shell has the app's own features (Wallet, sharing into a trip, the
|
||||
* edge swipe back).
|
||||
*/
|
||||
export const PHONE_QUERY = '(max-width: 767px), (pointer: coarse) and (max-height: 500px)'
|
||||
|
||||
/** Whether the phone shell applies right now, for code that is not a component. */
|
||||
export function isPhoneViewport(): boolean {
|
||||
if (isNativeApp()) return true
|
||||
return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(PHONE_QUERY).matches
|
||||
}
|
||||
|
||||
@@ -28,6 +38,7 @@ export function useIsPhone(): boolean {
|
||||
const [isPhone, setIsPhone] = useState(isPhoneViewport)
|
||||
|
||||
useEffect(() => {
|
||||
if (isNativeApp()) return
|
||||
const mq = window.matchMedia(PHONE_QUERY)
|
||||
const handler = (e: MediaQueryListEvent) => setIsPhone(e.matches)
|
||||
setIsPhone(mq.matches)
|
||||
|
||||
@@ -123,6 +123,18 @@ export interface TrekShellPlugin {
|
||||
event: 'storeTransaction',
|
||||
listener: (payload: StoreRestoreResult) => void
|
||||
): Promise<{ remove: () => Promise<void> }>;
|
||||
/**
|
||||
* Feature keyCommands (iOS, Android): the shortcuts a hardware keyboard has right now,
|
||||
* with their names in the UI's language. The app lists them in the overlay a
|
||||
* held Command key shows and in the iPadOS menu bar, Android in its
|
||||
* keyboard shortcuts list.
|
||||
*/
|
||||
setKeyCommands(options: { commands: NativeKeyCommand[] }): Promise<void>;
|
||||
/** Feature keyCommands: one of those shortcuts was pressed. */
|
||||
addListener(
|
||||
event: 'keyCommand',
|
||||
listener: (payload: { id: string }) => void
|
||||
): Promise<{ remove: () => Promise<void> }>;
|
||||
}
|
||||
|
||||
/** What Google Play Billing answers a restore with (Android, feature playBilling), beside iOS's `jws`. */
|
||||
@@ -133,6 +145,16 @@ export interface StoreRestoreResult {
|
||||
transactionId?: string;
|
||||
}
|
||||
|
||||
/** A keyboard shortcut as the app registers it (UIKeyCommand on iOS, a KeyboardShortcutInfo on Android). */
|
||||
export interface NativeKeyCommand {
|
||||
id: string;
|
||||
title: string;
|
||||
/** The key: a character, or one of 'left', 'right', 'up', 'down', 'escape'. */
|
||||
input: string;
|
||||
/** Any of 'command', 'shift', 'option', 'control'. */
|
||||
modifiers: string[];
|
||||
}
|
||||
|
||||
/** A document shared to TREK, as the native side reads it. */
|
||||
export interface SharedFilePayload {
|
||||
name: string;
|
||||
|
||||
@@ -119,5 +119,15 @@ export default {
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [],
|
||||
plugins: [
|
||||
// The touch shell's size classes (src/hooks/sizeClass.ts) as the `wide:` and
|
||||
// `split:` variants. Variants of their own rather than entries in `screens`:
|
||||
// both need a height bound (a phone on its side stays compact), and a raw
|
||||
// screen among the min-width ones reorders how Tailwind sorts every
|
||||
// responsive class.
|
||||
({ addVariant }) => {
|
||||
addVariant('wide', '@media (min-width: 600px) and (min-height: 501px)')
|
||||
addVariant('split', '@media (min-width: 900px) and (min-height: 501px)')
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -327,6 +327,7 @@ export function buildShell(overrides: Partial<MTripShellApi> = {}): MTripShellAp
|
||||
view: 'plan',
|
||||
rtView: 'list',
|
||||
mapFront: false,
|
||||
paneOpen: false,
|
||||
toggleRtView: vi.fn(),
|
||||
rtReach: 'ahead',
|
||||
setRtReach: vi.fn(),
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { act } from '@testing-library/react';
|
||||
import { SPLIT_QUERY, WIDE_QUERY } from '../../src/hooks/sizeClass';
|
||||
|
||||
/**
|
||||
* The touch shell's size class in tests (src/hooks/sizeClass.ts).
|
||||
*
|
||||
* jsdom's window is 1024×768, which the real queries would read as an iPad, so
|
||||
* every phone test would run the wide layout. tests/setup.ts answers the two
|
||||
* size-class queries from here instead: compact unless a test sets another,
|
||||
* and back to compact after each test.
|
||||
*/
|
||||
export type TestSizeClass = 'compact' | 'wide' | 'split';
|
||||
|
||||
let current: TestSizeClass = 'compact';
|
||||
|
||||
export function sizeClassMatches(query: string): boolean | null {
|
||||
if (query === WIDE_QUERY) return current !== 'compact';
|
||||
if (query === SPLIT_QUERY) return current === 'split';
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Switches the size class; the hooks follow as they would a rotation or a fold. */
|
||||
export function setSizeClass(next: TestSizeClass): void {
|
||||
act(() => {
|
||||
current = next;
|
||||
window.dispatchEvent(new Event('resize'));
|
||||
});
|
||||
}
|
||||
|
||||
/** Called by tests/setup.ts after each test. */
|
||||
export function resetSizeClass(): void {
|
||||
current = 'compact';
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import '@testing-library/jest-dom/vitest';
|
||||
import 'fake-indexeddb/auto';
|
||||
import { cleanup, configure } from '@testing-library/react';
|
||||
import { afterAll, afterEach, beforeAll, vi } from 'vitest';
|
||||
import { resetSizeClass, sizeClassMatches } from './helpers/sizeClass';
|
||||
import { server } from './helpers/msw/server';
|
||||
|
||||
// waitFor/findBy* default to 1s, which is enough on a dev machine but not on a
|
||||
@@ -35,6 +36,7 @@ beforeAll(() => server.listen({
|
||||
afterEach(() => {
|
||||
server.resetHandlers();
|
||||
cleanup();
|
||||
resetSizeClass();
|
||||
localStorage.clear();
|
||||
sessionStorage.clear();
|
||||
});
|
||||
@@ -59,6 +61,10 @@ Date.prototype.toLocaleDateString = function (locales?: Intl.LocalesArgument, op
|
||||
const mediaLists = new Set<{ media: string; matches: boolean; listeners: Set<(e: MediaQueryListEvent) => void> }>()
|
||||
|
||||
function widthMatches(query: string): boolean {
|
||||
// The touch shell's size classes come from tests/helpers/sizeClass.ts, compact
|
||||
// by default: jsdom's 1024px window would otherwise read as an iPad.
|
||||
const sizeClass = sizeClassMatches(query)
|
||||
if (sizeClass != null) return sizeClass
|
||||
const max = /\(\s*max-width:\s*(\d+)px\s*\)/.exec(query)
|
||||
if (max) return window.innerWidth <= Number(max[1])
|
||||
const min = /\(\s*min-width:\s*(\d+)px\s*\)/.exec(query)
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
import { FolderOpen, Map as MapIcon } from 'lucide-react';
|
||||
import { useLocation } from 'react-router';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import MNavRail from '../../../src/mobile/components/MNavRail';
|
||||
import MobileShell from '../../../src/mobile/MobileShell';
|
||||
import MTripRail from '../../../src/mobile/screens/trip/MTripRail';
|
||||
import { useAddonStore } from '../../../src/store/addonStore';
|
||||
import { useAuthStore } from '../../../src/store/authStore';
|
||||
import { usePluginStore } from '../../../src/store/pluginStore';
|
||||
import { buildUser } from '../../helpers/factories';
|
||||
import { fireEvent, render, screen, within } from '../../helpers/render';
|
||||
import { setSizeClass } from '../../helpers/sizeClass';
|
||||
|
||||
// FE-MOB-RAIL-001 onwards
|
||||
|
||||
function LocationEcho() {
|
||||
const location = useLocation();
|
||||
return <span data-testid="loc">{location.pathname + location.search}</span>;
|
||||
}
|
||||
|
||||
function seedAddons(ids: string[]) {
|
||||
useAddonStore.setState({
|
||||
addons: ids.map((id) => ({ id, name: id, type: 'global', icon: 'globe', enabled: true })),
|
||||
loaded: true,
|
||||
});
|
||||
}
|
||||
|
||||
const rail = () => screen.getByRole('navigation', { name: 'Navigation' });
|
||||
|
||||
describe('MNavRail', () => {
|
||||
beforeEach(() => {
|
||||
useAddonStore.setState({ addons: [], loaded: true });
|
||||
usePluginStore.setState({ plugins: [], loaded: true });
|
||||
useAuthStore.setState({ user: buildUser({ role: 'user' }) });
|
||||
});
|
||||
|
||||
it('FE-MOB-RAIL-001: holds every destination at once, the ones the dock keeps under More included', () => {
|
||||
seedAddons(['vacay', 'journey', 'atlas', 'collections']);
|
||||
render(<MNavRail />, { initialEntries: ['/dashboard'] });
|
||||
|
||||
for (const name of ['My Trips', 'Vacay', 'Journey', 'Atlas', 'Collections', 'Settings']) {
|
||||
expect(within(rail()).getByRole('button', { name })).toBeInTheDocument();
|
||||
}
|
||||
expect(within(rail()).queryByRole('button', { name: 'More' })).not.toBeInTheDocument();
|
||||
expect(within(rail()).queryByRole('button', { name: 'Admin Settings' })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-MOB-RAIL-002: marks the current section and navigates on a tap', () => {
|
||||
seedAddons(['atlas']);
|
||||
render(
|
||||
<>
|
||||
<MNavRail />
|
||||
<LocationEcho />
|
||||
</>,
|
||||
{ initialEntries: ['/atlas'] }
|
||||
);
|
||||
|
||||
expect(within(rail()).getByRole('button', { name: 'Atlas' })).toHaveAttribute('aria-current', 'page');
|
||||
fireEvent.click(within(rail()).getByRole('button', { name: 'My Trips' }));
|
||||
expect(screen.getByTestId('loc').textContent).toBe('/dashboard');
|
||||
fireEvent.click(within(rail()).getByRole('button', { name: 'Settings' }));
|
||||
expect(screen.getByTestId('loc').textContent).toBe('/settings');
|
||||
});
|
||||
|
||||
it('FE-MOB-RAIL-003: administration sits at the foot for an admin', () => {
|
||||
useAuthStore.setState({ user: buildUser({ role: 'admin' }) });
|
||||
render(<MNavRail />, { initialEntries: ['/dashboard'] });
|
||||
expect(within(rail()).getByRole('button', { name: 'Admin Settings' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("FE-MOB-RAIL-004: the create button keeps the dock's meaning and its exceptions", () => {
|
||||
const { unmount } = render(
|
||||
<>
|
||||
<MNavRail />
|
||||
<LocationEcho />
|
||||
</>,
|
||||
{ initialEntries: ['/dashboard'] }
|
||||
);
|
||||
const create = within(rail()).getAllByRole('button')[0];
|
||||
fireEvent.click(create);
|
||||
expect(screen.getByTestId('loc').textContent).toContain('create');
|
||||
unmount();
|
||||
|
||||
render(<MNavRail />, { initialEntries: ['/settings'] });
|
||||
expect(within(rail()).getAllByRole('button')[0]).toHaveAccessibleName('My Trips');
|
||||
});
|
||||
});
|
||||
|
||||
describe('MTripRail', () => {
|
||||
const tabs = [
|
||||
{ id: 'plan', label: 'Plan' },
|
||||
{ id: 'transports', label: 'Transport' },
|
||||
{ id: 'dateien', label: 'Files', icon: FolderOpen },
|
||||
{ id: 'plugin:x', label: 'Plugin', icon: MapIcon },
|
||||
];
|
||||
|
||||
it('FE-MOB-RAIL-005: every section is in the rail with its name, More keeps the actions', () => {
|
||||
const onSelect = vi.fn();
|
||||
const onMore = vi.fn();
|
||||
render(
|
||||
<MTripRail
|
||||
tabs={tabs}
|
||||
active="transports"
|
||||
onSelect={onSelect}
|
||||
onMore={onMore}
|
||||
labelOf={(id) => tabs.find((x) => x.id === id)?.label ?? id}
|
||||
/>
|
||||
);
|
||||
const nav = screen.getByRole('navigation', { name: 'Trip sections' });
|
||||
expect(
|
||||
within(nav)
|
||||
.getAllByRole('button')
|
||||
.map((b) => b.getAttribute('title'))
|
||||
).toEqual(['Plan', 'Transport', 'Files', 'Plugin', 'More']);
|
||||
expect(within(nav).getByRole('button', { name: 'Transport' })).toHaveAttribute('aria-current', 'page');
|
||||
|
||||
fireEvent.click(within(nav).getByRole('button', { name: 'Files' }));
|
||||
expect(onSelect).toHaveBeenCalledWith('dateien');
|
||||
fireEvent.click(within(nav).getByRole('button', { name: 'More' }));
|
||||
expect(onMore).toHaveBeenCalledOnce();
|
||||
});
|
||||
});
|
||||
|
||||
describe('MobileShell on a wide window', () => {
|
||||
beforeEach(() => {
|
||||
useAddonStore.setState({ addons: [], loaded: true });
|
||||
usePluginStore.setState({ plugins: [], loaded: true });
|
||||
});
|
||||
|
||||
it("FE-MOB-RAIL-006: the rail takes the dock's place and the page column starts after it", () => {
|
||||
setSizeClass('wide');
|
||||
const { container } = render(
|
||||
<MobileShell isPhone>
|
||||
<p>page body</p>
|
||||
</MobileShell>,
|
||||
{ initialEntries: ['/dashboard'] }
|
||||
);
|
||||
|
||||
expect(rail()).toBeInTheDocument();
|
||||
expect(container.querySelector('.m-dock-vt')?.tagName).toBe('NAV');
|
||||
expect(container.querySelector('.m-shell')).toBeInTheDocument();
|
||||
expect(screen.getByText('page body').parentElement?.className).toContain('wide:ps-[var(--m-rail-w)]');
|
||||
});
|
||||
|
||||
it('FE-MOB-RAIL-007: folding back to compact brings the dock back, the page stays mounted', () => {
|
||||
setSizeClass('wide');
|
||||
render(
|
||||
<MobileShell isPhone>
|
||||
<input aria-label="note" defaultValue="" />
|
||||
</MobileShell>,
|
||||
{ initialEntries: ['/dashboard'] }
|
||||
);
|
||||
const field = screen.getByLabelText('note') as HTMLInputElement;
|
||||
fireEvent.change(field, { target: { value: 'typed before the fold' } });
|
||||
|
||||
setSizeClass('compact');
|
||||
expect(screen.queryByRole('navigation', { name: 'Navigation' })).not.toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: 'My Trips' })).toBeInTheDocument();
|
||||
expect((screen.getByLabelText('note') as HTMLInputElement).value).toBe('typed before the fold');
|
||||
expect(screen.getByLabelText('note')).toBe(field);
|
||||
});
|
||||
|
||||
it('FE-MOB-RAIL-008: no rail inside a trip, which brings its own', () => {
|
||||
setSizeClass('wide');
|
||||
render(
|
||||
<MobileShell isPhone>
|
||||
<p>page body</p>
|
||||
</MobileShell>,
|
||||
{ initialEntries: ['/trips/7'] }
|
||||
);
|
||||
expect(screen.queryByRole('navigation', { name: 'Navigation' })).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,240 @@
|
||||
import { useLocation } from 'react-router';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import {
|
||||
findShortcut,
|
||||
isTypingTarget,
|
||||
matchesShortcut,
|
||||
toNativeCommand,
|
||||
useShortcutRegistry,
|
||||
type Shortcut,
|
||||
} from '../../../src/mobile/keyboard/shortcuts';
|
||||
import { useShortcuts } from '../../../src/mobile/keyboard/useShortcuts';
|
||||
import { useAddonStore } from '../../../src/store/addonStore';
|
||||
import { usePluginStore } from '../../../src/store/pluginStore';
|
||||
import { act, fireEvent, render, screen, waitFor } from '../../helpers/render';
|
||||
|
||||
// FE-MOB-KEYS-001 onwards
|
||||
|
||||
const native = vi.hoisted(() => ({
|
||||
ios: false,
|
||||
features: [] as string[],
|
||||
setKeyCommands: vi.fn(() => Promise.resolve()),
|
||||
listener: null as null | ((p: { id: string }) => void),
|
||||
}));
|
||||
|
||||
vi.mock('../../../src/native/platform', () => ({
|
||||
isNativeApp: () => native.ios,
|
||||
isNativeIos: () => native.ios,
|
||||
nativeServerHost: () => null,
|
||||
}));
|
||||
vi.mock('../../../src/native/capabilities', () => ({
|
||||
useNativeCapabilities: () => ({
|
||||
caps: { shellApi: 2, platform: 'ios', appVersion: '', build: '', features: native.features },
|
||||
updateRequired: false,
|
||||
}),
|
||||
}));
|
||||
vi.mock('../../../src/native/trekShell', () => ({
|
||||
TrekShell: {
|
||||
setKeyCommands: native.setKeyCommands,
|
||||
addListener: vi.fn((_event: string, fn: (p: { id: string }) => void) => {
|
||||
native.listener = fn;
|
||||
return Promise.resolve({ remove: () => Promise.resolve() });
|
||||
}),
|
||||
},
|
||||
}));
|
||||
|
||||
import MKeyboardHost from '../../../src/mobile/keyboard/MKeyboardHost';
|
||||
import MShellShortcuts from '../../../src/mobile/keyboard/MShellShortcuts';
|
||||
|
||||
const key = (k: string, mods: Partial<KeyboardEvent> = {}) => ({
|
||||
key: k,
|
||||
metaKey: false,
|
||||
ctrlKey: false,
|
||||
shiftKey: false,
|
||||
altKey: false,
|
||||
...mods,
|
||||
});
|
||||
|
||||
describe('shortcut matching', () => {
|
||||
const save: Shortcut = { id: 's', title: 'Save', key: 's', mod: true, run: () => {} };
|
||||
const sidebar: Shortcut = { id: 'p', title: 'Sidebar', key: 's', ctrl: true, run: () => {} };
|
||||
const next: Shortcut = { id: 'n', title: 'Next', key: 'ArrowRight', alt: true, run: () => {} };
|
||||
|
||||
it('FE-MOB-KEYS-001: ⌘ and Ctrl both count as the command key, the rest must match exactly', () => {
|
||||
expect(matchesShortcut(key('s', { metaKey: true }), save)).toBe(true);
|
||||
expect(matchesShortcut(key('S', { ctrlKey: true }), save)).toBe(true);
|
||||
expect(matchesShortcut(key('s'), save)).toBe(false);
|
||||
expect(matchesShortcut(key('s', { metaKey: true, shiftKey: true }), save)).toBe(false);
|
||||
expect(matchesShortcut(key('s', { metaKey: true, ctrlKey: true }), sidebar)).toBe(true);
|
||||
expect(matchesShortcut(key('s', { metaKey: true }), sidebar)).toBe(false);
|
||||
expect(matchesShortcut(key('ArrowRight', { altKey: true }), next)).toBe(true);
|
||||
});
|
||||
|
||||
it('FE-MOB-KEYS-002: a field keeps its own keys, except the ones with ⌘', () => {
|
||||
const field = document.createElement('input');
|
||||
expect(isTypingTarget(field)).toBe(true);
|
||||
expect(isTypingTarget(document.body)).toBe(false);
|
||||
expect(findShortcut({ ...key('ArrowRight', { altKey: true }), target: field }, [[next]])).toBeNull();
|
||||
expect(findShortcut({ ...key('s', { metaKey: true }), target: field }, [[save]])).toBe(save);
|
||||
});
|
||||
|
||||
it("FE-MOB-KEYS-003: a later list wins, so a trip's shortcut goes before the shell's", () => {
|
||||
const shell: Shortcut = { ...save, id: 'shell' };
|
||||
const trip: Shortcut = { ...save, id: 'trip' };
|
||||
expect(findShortcut({ ...key('s', { metaKey: true }), target: document.body }, [[shell], [trip]])).toBe(trip);
|
||||
});
|
||||
|
||||
it('FE-MOB-KEYS-004: a shortcut becomes a native key command under an id unique across screens', () => {
|
||||
expect(toNativeCommand('trip', next)).toEqual({
|
||||
id: 'trip:n',
|
||||
title: 'Next',
|
||||
input: 'right',
|
||||
modifiers: ['option'],
|
||||
});
|
||||
expect(toNativeCommand('shell', sidebar)).toEqual({
|
||||
id: 'shell:p',
|
||||
title: 'Sidebar',
|
||||
input: 's',
|
||||
modifiers: ['command', 'control'],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function Probe({ owner, shortcuts }: { owner: string; shortcuts: Shortcut[] }) {
|
||||
useShortcuts(owner, shortcuts);
|
||||
return null;
|
||||
}
|
||||
|
||||
function LocationEcho() {
|
||||
const location = useLocation();
|
||||
return <span data-testid="loc">{location.pathname + location.search}</span>;
|
||||
}
|
||||
|
||||
describe('MKeyboardHost', () => {
|
||||
beforeEach(() => {
|
||||
native.ios = false;
|
||||
native.features = [];
|
||||
native.setKeyCommands.mockClear();
|
||||
native.listener = null;
|
||||
useShortcutRegistry.setState({ lists: [] });
|
||||
});
|
||||
afterEach(() => useShortcutRegistry.setState({ lists: [] }));
|
||||
|
||||
it('FE-MOB-KEYS-005: in a browser the page answers the keys and runs the newest handler', () => {
|
||||
const first = vi.fn();
|
||||
const second = vi.fn();
|
||||
const shortcut = (run: () => void): Shortcut[] => [{ id: 'go', title: 'Go', key: '1', mod: true, run }];
|
||||
const { rerender } = render(
|
||||
<>
|
||||
<MKeyboardHost />
|
||||
<Probe owner="a" shortcuts={shortcut(first)} />
|
||||
</>
|
||||
);
|
||||
rerender(
|
||||
<>
|
||||
<MKeyboardHost />
|
||||
<Probe owner="a" shortcuts={shortcut(second)} />
|
||||
</>
|
||||
);
|
||||
|
||||
fireEvent.keyDown(document.body, { key: '1', metaKey: true });
|
||||
expect(first).not.toHaveBeenCalled();
|
||||
expect(second).toHaveBeenCalledOnce();
|
||||
expect(native.setKeyCommands).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('FE-MOB-KEYS-006: a screen that goes away takes its shortcuts with it', () => {
|
||||
const run = vi.fn();
|
||||
const { rerender } = render(
|
||||
<>
|
||||
<MKeyboardHost />
|
||||
<Probe owner="a" shortcuts={[{ id: 'go', title: 'Go', key: '1', mod: true, run }]} />
|
||||
</>
|
||||
);
|
||||
rerender(<MKeyboardHost />);
|
||||
fireEvent.keyDown(document.body, { key: '1', metaKey: true });
|
||||
expect(run).not.toHaveBeenCalled();
|
||||
expect(useShortcutRegistry.getState().lists).toEqual([]);
|
||||
});
|
||||
|
||||
it('FE-MOB-KEYS-007: the app takes the ⌘ shortcuts as key commands, names and all, and reports them back', async () => {
|
||||
native.ios = true;
|
||||
native.features = ['keyCommands'];
|
||||
const run = vi.fn();
|
||||
const step = vi.fn();
|
||||
render(
|
||||
<>
|
||||
<MKeyboardHost />
|
||||
<Probe
|
||||
owner="trip"
|
||||
shortcuts={[
|
||||
{ id: 'tab-plan', title: 'Plan', key: '1', mod: true, run },
|
||||
{ id: 'day-next', title: 'Next day', key: 'ArrowRight', alt: true, run: step },
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
await waitFor(() =>
|
||||
expect(native.setKeyCommands).toHaveBeenLastCalledWith({
|
||||
commands: [{ id: 'trip:tab-plan', title: 'Plan', input: '1', modifiers: ['command'] }],
|
||||
})
|
||||
);
|
||||
|
||||
// The page leaves ⌘1 to the app, so it cannot run twice…
|
||||
fireEvent.keyDown(document.body, { key: '1', metaKey: true });
|
||||
expect(run).not.toHaveBeenCalled();
|
||||
// …and still answers a key without ⌘ itself.
|
||||
fireEvent.keyDown(document.body, { key: 'ArrowRight', altKey: true });
|
||||
expect(step).toHaveBeenCalledOnce();
|
||||
|
||||
await waitFor(() => expect(native.listener).not.toBeNull());
|
||||
act(() => native.listener?.({ id: 'trip:tab-plan' }));
|
||||
expect(run).toHaveBeenCalledOnce();
|
||||
});
|
||||
});
|
||||
|
||||
describe('MShellShortcuts', () => {
|
||||
beforeEach(() => {
|
||||
native.ios = false;
|
||||
useShortcutRegistry.setState({ lists: [] });
|
||||
usePluginStore.setState({ plugins: [], loaded: true });
|
||||
useAddonStore.setState({
|
||||
addons: [{ id: 'atlas', name: 'atlas', type: 'global', icon: 'globe', enabled: true }],
|
||||
loaded: true,
|
||||
} as never);
|
||||
});
|
||||
|
||||
it('FE-MOB-KEYS-008: ⌘1… go to the sections, ⌘N creates, ⌘, opens settings', () => {
|
||||
render(
|
||||
<>
|
||||
<MKeyboardHost />
|
||||
<MShellShortcuts />
|
||||
<LocationEcho />
|
||||
</>,
|
||||
{ initialEntries: ['/dashboard'] }
|
||||
);
|
||||
const at = () => screen.getByTestId('loc').textContent;
|
||||
|
||||
fireEvent.keyDown(document.body, { key: '2', metaKey: true });
|
||||
expect(at()).toBe('/atlas');
|
||||
fireEvent.keyDown(document.body, { key: '1', metaKey: true });
|
||||
expect(at()).toBe('/dashboard');
|
||||
fireEvent.keyDown(document.body, { key: 'n', metaKey: true });
|
||||
expect(at()).toBe('/dashboard?create=1');
|
||||
fireEvent.keyDown(document.body, { key: ',', metaKey: true });
|
||||
expect(at()).toBe('/settings');
|
||||
});
|
||||
|
||||
it('FE-MOB-KEYS-009: inside a trip the numbers belong to the trip', () => {
|
||||
render(
|
||||
<>
|
||||
<MKeyboardHost />
|
||||
<MShellShortcuts />
|
||||
<LocationEcho />
|
||||
</>,
|
||||
{ initialEntries: ['/trips/4'] }
|
||||
);
|
||||
fireEvent.keyDown(document.body, { key: '2', metaKey: true });
|
||||
expect(screen.getByTestId('loc').textContent).toBe('/trips/4');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,146 @@
|
||||
import { act, renderHook } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { beforeEach, describe, expect, it } from 'vitest';
|
||||
import JourneyEntryCover, { type CoverEntry } from '../../../src/components/Journey/JourneyEntryCover';
|
||||
import MSheet from '../../../src/mobile/components/MSheet';
|
||||
import { edgeFadeClass, useEdgeFade } from '../../../src/mobile/components/useEdgeFade';
|
||||
import MSettings from '../../../src/mobile/screens/settings/MSettings';
|
||||
import { usePluginStore } from '../../../src/store/pluginStore';
|
||||
import { useSettingsStore } from '../../../src/store/settingsStore';
|
||||
import { buildSettings } from '../../helpers/factories';
|
||||
import { render, screen } from '../../helpers/render';
|
||||
import { setSizeClass } from '../../helpers/sizeClass';
|
||||
import { resetAllStores, seedStore } from '../../helpers/store';
|
||||
|
||||
// FE-MOB-LARGE-001 onwards: the touch shell's pieces laid out for a wide window.
|
||||
|
||||
describe('MSheet on a wide window', () => {
|
||||
it('FE-MOB-LARGE-001: a sheet becomes a centred form sheet of the width it asks for', () => {
|
||||
render(
|
||||
<MSheet open onClose={() => {}} variant="bottom" wideWidth="large" ariaLabel="Form">
|
||||
<span>body</span>
|
||||
</MSheet>
|
||||
);
|
||||
const frame = screen.getByRole('dialog', { name: 'Form' }).parentElement as HTMLElement;
|
||||
expect(frame.className).toContain('wide:mx-auto');
|
||||
expect(frame.className).toContain('wide:top-1/2');
|
||||
expect(frame.className).toContain('wide:w-[min(720px,calc(100%-48px))]');
|
||||
expect(frame.querySelector('[aria-hidden="true"].wide\\:block')).toBeNull();
|
||||
});
|
||||
|
||||
it("FE-MOB-LARGE-002: a menu from the rail's foot is a popover beside it, with an arrow", () => {
|
||||
render(
|
||||
<MSheet
|
||||
open
|
||||
onClose={() => {}}
|
||||
variant="bottom"
|
||||
dimTransparent
|
||||
wideWidth="compact"
|
||||
wideAnchor="rail-foot"
|
||||
ariaLabel="More"
|
||||
>
|
||||
<span>body</span>
|
||||
</MSheet>
|
||||
);
|
||||
const frame = screen.getByRole('dialog', { name: 'More' }).parentElement as HTMLElement;
|
||||
expect(frame.className).toContain('wide:start-[calc(var(--m-rail-w)+6px)]');
|
||||
expect(frame.className).not.toContain('wide:mx-auto');
|
||||
expect(frame.className).toContain('wide:w-[min(320px,calc(100%-48px))]');
|
||||
expect(frame.querySelector(':scope > span[aria-hidden="true"]')).not.toBeNull();
|
||||
});
|
||||
|
||||
it('FE-MOB-LARGE-003: the drawer keeps its own place', () => {
|
||||
render(
|
||||
<MSheet open onClose={() => {}} variant="drawer" ariaLabel="Drawer">
|
||||
<span>body</span>
|
||||
</MSheet>
|
||||
);
|
||||
const frame = screen.getByRole('dialog', { name: 'Drawer' }).parentElement as HTMLElement;
|
||||
expect(frame.className).not.toContain('wide:');
|
||||
});
|
||||
});
|
||||
|
||||
describe('useEdgeFade', () => {
|
||||
function strip(scrollWidth: number, clientWidth: number, scrollLeft = 0) {
|
||||
const el = document.createElement('div');
|
||||
Object.defineProperty(el, 'scrollWidth', { configurable: true, value: scrollWidth });
|
||||
Object.defineProperty(el, 'clientWidth', { configurable: true, value: clientWidth });
|
||||
el.scrollLeft = scrollLeft;
|
||||
return el;
|
||||
}
|
||||
|
||||
it('FE-MOB-LARGE-004: fades the edges that have more behind them, and follows scrolling', () => {
|
||||
const el = strip(900, 400);
|
||||
const { result } = renderHook(() => useEdgeFade(el));
|
||||
expect(result.current).toEqual({ start: false, end: true });
|
||||
expect(edgeFadeClass(result.current)).toBe('m-fade-e');
|
||||
|
||||
act(() => {
|
||||
el.scrollLeft = 200;
|
||||
el.dispatchEvent(new Event('scroll'));
|
||||
});
|
||||
expect(edgeFadeClass(result.current)).toBe('m-fade-se');
|
||||
|
||||
act(() => {
|
||||
el.scrollLeft = 500;
|
||||
el.dispatchEvent(new Event('scroll'));
|
||||
});
|
||||
expect(edgeFadeClass(result.current)).toBe('m-fade-s');
|
||||
});
|
||||
|
||||
it('FE-MOB-LARGE-005: a strip that fits fades nowhere, and a right-to-left one counts from its start', () => {
|
||||
expect(edgeFadeClass(renderHook(() => useEdgeFade(strip(400, 400))).result.current)).toBe('');
|
||||
expect(renderHook(() => useEdgeFade(strip(900, 400, -500))).result.current).toEqual({ start: true, end: false });
|
||||
expect(renderHook(() => useEdgeFade(null)).result.current).toEqual({ start: false, end: false });
|
||||
});
|
||||
});
|
||||
|
||||
describe('JourneyEntryCover sizes', () => {
|
||||
const entry = (overrides: Partial<CoverEntry> = {}): CoverEntry => ({
|
||||
id: 10,
|
||||
type: 'entry',
|
||||
title: 'Fushimi Inari Taisha',
|
||||
entry_date: '2026-11-07',
|
||||
location_name: 'Kyoto, Japan',
|
||||
country_code: 'JP',
|
||||
photos: [],
|
||||
...overrides,
|
||||
});
|
||||
|
||||
it('FE-MOB-LARGE-006: the large card has room for the whole place on two lines', () => {
|
||||
render(<JourneyEntryCover entry={entry()} dayColor="#14b8a6" isActive={false} onClick={() => {}} size="large" />);
|
||||
const card = screen.getByRole('button');
|
||||
expect(card.className).toContain('w-[176px]');
|
||||
expect(screen.getByText('Kyoto, Japan').className).toContain('line-clamp-2');
|
||||
});
|
||||
|
||||
it("FE-MOB-LARGE-007: a card without a photo is the day's colour, not an empty grey", () => {
|
||||
render(<JourneyEntryCover entry={entry()} dayColor="#14b8a6" isActive={false} onClick={() => {}} tone="mobile" />);
|
||||
const card = screen.getByRole('button');
|
||||
expect(card.style.backgroundImage).toContain('rgba(20, 184, 166, 0.85)');
|
||||
expect(card.className).toContain('w-[136px]');
|
||||
expect(screen.getByText('Kyoto, Japan').className).toContain('truncate');
|
||||
});
|
||||
});
|
||||
|
||||
describe('MSettings with room for two panes', () => {
|
||||
beforeEach(() => {
|
||||
resetAllStores();
|
||||
seedStore(useSettingsStore, { settings: buildSettings({ language: 'en' }) });
|
||||
usePluginStore.setState({ plugins: [], loaded: true });
|
||||
});
|
||||
|
||||
it('FE-MOB-LARGE-008: the sections stand in a list beside the page, the dropdown goes', async () => {
|
||||
setSizeClass('split');
|
||||
const user = userEvent.setup();
|
||||
render(<MSettings />, { initialEntries: ['/settings'] });
|
||||
|
||||
const list = screen.getByRole('navigation', { name: 'Settings' });
|
||||
expect(list).toBeInTheDocument();
|
||||
expect(screen.queryByRole('button', { expanded: false })).not.toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: 'General' })).toHaveAttribute('aria-current', 'page');
|
||||
|
||||
await user.click(screen.getByRole('button', { name: 'Appearance' }));
|
||||
expect(screen.getByRole('button', { name: 'Appearance' })).toHaveAttribute('aria-current', 'page');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,64 @@
|
||||
import { renderHook } from '@testing-library/react';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { SPLIT_QUERY, WIDE_QUERY, isWideViewport, useIsSplit, useIsWide } from '../../../src/hooks/sizeClass';
|
||||
import { setSizeClass } from '../../helpers/sizeClass';
|
||||
|
||||
// FE-MOB-SIZE-001 onwards
|
||||
|
||||
const root = resolve(__dirname, '../../..');
|
||||
|
||||
describe('size classes', () => {
|
||||
it('FE-MOB-SIZE-001: the Tailwind variants and the stylesheet use the same queries as the hooks', () => {
|
||||
const tailwind = readFileSync(resolve(root, 'tailwind.config.js'), 'utf8');
|
||||
expect(tailwind).toContain(`addVariant('wide', '@media ${WIDE_QUERY}')`);
|
||||
expect(tailwind).toContain(`addVariant('split', '@media ${SPLIT_QUERY}')`);
|
||||
const css = readFileSync(resolve(root, 'src/mobile/mobile.css'), 'utf8');
|
||||
const queries = [...css.matchAll(/@media ([^{]*min-height: 501px[^{]*)\{/g)].map((m) => m[1].trim());
|
||||
expect(queries.length).toBeGreaterThan(0);
|
||||
for (const q of queries) expect(q).toBe(WIDE_QUERY);
|
||||
});
|
||||
|
||||
it('FE-MOB-SIZE-002: a phone on its side stays compact, a tablet and an unfolded foldable do not', () => {
|
||||
// The queries evaluated by hand for the sizes that matter: jsdom has no height feature.
|
||||
const evaluate = (query: string, w: number, h: number) => {
|
||||
const minW = Number(/min-width: (\d+)px/.exec(query)?.[1]);
|
||||
const minH = Number(/min-height: (\d+)px/.exec(query)?.[1]);
|
||||
return w >= minW && h >= minH;
|
||||
};
|
||||
const sizes: Record<string, [number, number, boolean, boolean]> = {
|
||||
phone: [402, 874, false, false],
|
||||
phoneLandscape: [956, 440, false, false],
|
||||
ipadMiniPortrait: [744, 1133, true, false],
|
||||
ipad13Landscape: [1376, 1032, true, true],
|
||||
ipad11SplitHalf: [590, 834, false, false],
|
||||
ipad13SplitHalf: [683, 1032, true, false],
|
||||
duoUnfoldedLandscape: [1017, 699, true, true],
|
||||
duoUnfoldedPortrait: [699, 1017, true, false],
|
||||
};
|
||||
for (const [name, [w, h, wide, split]] of Object.entries(sizes)) {
|
||||
expect([name, evaluate(WIDE_QUERY, w, h)]).toEqual([name, wide]);
|
||||
expect([name, evaluate(SPLIT_QUERY, w, h)]).toEqual([name, split]);
|
||||
}
|
||||
});
|
||||
|
||||
it('FE-MOB-SIZE-003: the hooks follow a change of size class, as on a rotation or a fold', () => {
|
||||
const wide = renderHook(() => useIsWide());
|
||||
const split = renderHook(() => useIsSplit());
|
||||
expect(wide.result.current).toBe(false);
|
||||
expect(split.result.current).toBe(false);
|
||||
|
||||
setSizeClass('wide');
|
||||
expect(wide.result.current).toBe(true);
|
||||
expect(split.result.current).toBe(false);
|
||||
expect(isWideViewport()).toBe(true);
|
||||
|
||||
setSizeClass('split');
|
||||
expect(split.result.current).toBe(true);
|
||||
|
||||
setSizeClass('compact');
|
||||
expect(wide.result.current).toBe(false);
|
||||
expect(split.result.current).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,185 @@
|
||||
import { http, HttpResponse } from 'msw';
|
||||
import { useEffect } from 'react';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import MKeyboardHost from '../../../../src/mobile/keyboard/MKeyboardHost';
|
||||
import { useShortcutRegistry } from '../../../../src/mobile/keyboard/shortcuts';
|
||||
import type { MTripShellApi, TripPlanner } from '../../../../src/mobile/screens/trip/MTripShell';
|
||||
import { useAuthStore } from '../../../../src/store/authStore';
|
||||
import { useDocSyncOfferStore } from '../../../../src/store/docSyncOfferStore';
|
||||
import type { Day } from '../../../../src/types';
|
||||
import { buildPlanner } from '../../../helpers/mobileTrip';
|
||||
import { server } from '../../../helpers/msw/server';
|
||||
import { fireEvent, render, screen, within } from '../../../helpers/render';
|
||||
import { setSizeClass } from '../../../helpers/sizeClass';
|
||||
import { seedStore } from '../../../helpers/store';
|
||||
|
||||
// FE-MOB-SHELLW-001 onwards: the trip screen on a wide window (iPad, foldable unfolded).
|
||||
|
||||
const mocks = vi.hoisted(() => ({ planner: {} as TripPlanner }));
|
||||
|
||||
vi.mock('../../../../src/pages/tripPlanner/useTripPlanner', () => ({
|
||||
useTripPlanner: () => mocks.planner,
|
||||
}));
|
||||
vi.mock('../../../../src/mobile/screens/trip/plan/MPlanTimeline', () => ({ default: () => null }));
|
||||
vi.mock('../../../../src/mobile/screens/trip/map/MMapArea', () => ({ default: () => null }));
|
||||
vi.mock('../../../../src/mobile/screens/trip/places/MPlacesBrowser', () => ({ default: () => null }));
|
||||
vi.mock('../../../../src/mobile/screens/trip/tabs/MTripTabPanel', () => ({ default: () => null }));
|
||||
vi.mock('../../../../src/mobile/screens/trip/sheets/MTripSheets', () => ({ default: () => null }));
|
||||
|
||||
import MTripShell from '../../../../src/mobile/screens/trip/MTripShell';
|
||||
|
||||
// Recorded through spies, not module variables a render would write to.
|
||||
const seen = vi.fn<(shell: MTripShellApi) => void>();
|
||||
const mapMounted = vi.fn();
|
||||
const shellApi = () => seen.mock.lastCall?.[0] as MTripShellApi;
|
||||
|
||||
function slot(testId: string) {
|
||||
return function Slot({ shell }: { planner: TripPlanner; shell: MTripShellApi }) {
|
||||
seen(shell);
|
||||
return <div data-testid={testId} />;
|
||||
};
|
||||
}
|
||||
const PlanTimelineSlot = slot('plan-timeline');
|
||||
const PlacesBrowserSlot = slot('places-browser');
|
||||
const SheetsSlot = slot('sheets');
|
||||
function MapAreaSlot({ shell }: { planner: TripPlanner; shell: MTripShellApi }) {
|
||||
seen(shell);
|
||||
useEffect(() => {
|
||||
mapMounted();
|
||||
}, []);
|
||||
return <div data-testid="map-area" />;
|
||||
}
|
||||
function TabSlot({ shell, tab }: { planner: TripPlanner; shell: MTripShellApi; tab: string }) {
|
||||
seen(shell);
|
||||
return <div data-testid="tab-panel">{tab}</div>;
|
||||
}
|
||||
|
||||
const TRIP_TABS = [
|
||||
{ id: 'plan', label: 'Plan' },
|
||||
{ id: 'transports', label: 'Transport' },
|
||||
{ id: 'buchungen', label: 'Bookings' },
|
||||
{ id: 'finanzplan', label: 'Budget' },
|
||||
{ id: 'listen', label: 'Lists' },
|
||||
{ id: 'dateien', label: 'Files' },
|
||||
{ id: 'collab', label: 'Collaboration' },
|
||||
];
|
||||
|
||||
const DAYS = [
|
||||
{ id: 11, trip_id: 1, day_number: 1, date: '2026-05-02', title: null },
|
||||
{ id: 12, trip_id: 1, day_number: 2, date: '2026-05-03', title: null },
|
||||
{ id: 13, trip_id: 1, day_number: 3, date: '2026-05-04', title: null },
|
||||
] as unknown as Day[];
|
||||
|
||||
function renderShell(overrides: Partial<TripPlanner> = {}) {
|
||||
mocks.planner = buildPlanner({ days: DAYS, selectedDayId: 12, TRIP_TABS, ...overrides } as Partial<TripPlanner>);
|
||||
return render(
|
||||
<>
|
||||
<MKeyboardHost />
|
||||
<MTripShell
|
||||
PlanTimeline={PlanTimelineSlot}
|
||||
MapArea={MapAreaSlot}
|
||||
PlacesBrowser={PlacesBrowserSlot}
|
||||
TabPanel={TabSlot}
|
||||
Sheets={SheetsSlot}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const tripRail = () => screen.getByRole('navigation', { name: 'Trip sections' });
|
||||
const root = (container: HTMLElement) => container.querySelector('.m-trip') as HTMLElement;
|
||||
|
||||
describe('MTripShell on a wide window', () => {
|
||||
beforeEach(() => {
|
||||
sessionStorage.clear();
|
||||
seen.mockClear();
|
||||
mapMounted.mockClear();
|
||||
useShortcutRegistry.setState({ lists: [] });
|
||||
useDocSyncOfferStore.setState({ bound: {}, providers: null });
|
||||
seedStore(useAuthStore, { user: null, isAuthenticated: false });
|
||||
server.use(
|
||||
http.get('/api/trips/:tripId/docsync/providers', () => HttpResponse.json([])),
|
||||
http.get('/api/trips/:tripId/docsync/links', () => HttpResponse.json([]))
|
||||
);
|
||||
});
|
||||
|
||||
it('FE-MOB-SHELLW-001: the sections stand in a rail, every one of them, instead of the dock', () => {
|
||||
setSizeClass('wide');
|
||||
renderShell();
|
||||
const labels = within(tripRail())
|
||||
.getAllByRole('button')
|
||||
.map((b) => b.getAttribute('title'));
|
||||
expect(labels).toEqual(['Plan', 'Transport', 'Bookings', 'Budget', 'Lists', 'Files', 'Collaboration', 'More']);
|
||||
fireEvent.click(within(tripRail()).getByRole('button', { name: 'Files' }));
|
||||
expect(mocks.planner.handleTabChange).toHaveBeenCalledWith('dateien');
|
||||
fireEvent.click(within(tripRail()).getByRole('button', { name: 'More' }));
|
||||
expect(shellApi().sheet).toEqual({ id: 'mehr', payload: undefined });
|
||||
});
|
||||
|
||||
it('FE-MOB-SHELLW-002: with room for two panes the plan sits beside the map, which follows its day', () => {
|
||||
setSizeClass('split');
|
||||
const { container } = renderShell();
|
||||
expect(screen.getByTestId('plan-timeline')).toBeInTheDocument();
|
||||
expect(shellApi().paneOpen).toBe(true);
|
||||
// The map is on screen too, so its chrome is up and "show on map" has nowhere to go.
|
||||
expect(shellApi().mapFront).toBe(true);
|
||||
expect(root(container).style.getPropertyValue('--trip-pane')).toBe('var(--trip-pane-open)');
|
||||
expect(mocks.planner.autoShowRoute).toHaveBeenCalled();
|
||||
expect(mocks.planner.setExpandedDayIds).toHaveBeenCalledWith(new Set([12]));
|
||||
});
|
||||
|
||||
it('FE-MOB-SHELLW-003: the switch hides and shows the pane like a sidebar, the map runs under the rail meanwhile', () => {
|
||||
setSizeClass('split');
|
||||
const { container } = renderShell();
|
||||
fireEvent.click(screen.getByRole('button', { name: 'mobileTrip.hidePane' }));
|
||||
expect(shellApi().paneOpen).toBe(false);
|
||||
expect(screen.queryByTestId('plan-timeline')).not.toBeInTheDocument();
|
||||
expect(root(container).style.getPropertyValue('--trip-map-start')).toBe('0px');
|
||||
expect(root(container).style.getPropertyValue('--trip-map-inset')).toBe('var(--m-rail-w)');
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: 'mobileTrip.showPane' }));
|
||||
expect(shellApi().paneOpen).toBe(true);
|
||||
expect(screen.getByTestId('plan-timeline')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-MOB-SHELLW-004: folding to compact mid-plan keeps the map and the day, and brings the dock back', () => {
|
||||
setSizeClass('split');
|
||||
renderShell();
|
||||
const mountsBefore = mapMounted.mock.calls.length;
|
||||
setSizeClass('compact');
|
||||
expect(screen.queryByRole('navigation', { name: 'Trip sections' })).not.toBeInTheDocument();
|
||||
// The dock's More, named by the planner's t like the rest of the dock.
|
||||
expect(screen.getByRole('button', { name: 'mobileTrip.more' })).toBeInTheDocument();
|
||||
expect(shellApi().paneOpen).toBe(false);
|
||||
expect(shellApi().view).toBe('plan');
|
||||
expect(screen.getByTestId('plan-timeline')).toBeInTheDocument();
|
||||
// The same map instance, not a new one: a remount reloads every tile.
|
||||
expect(mapMounted).toHaveBeenCalledTimes(mountsBefore);
|
||||
});
|
||||
|
||||
it('FE-MOB-SHELLW-005: a hardware keyboard switches sections, steps through days and toggles the pane', () => {
|
||||
setSizeClass('split');
|
||||
renderShell();
|
||||
fireEvent.keyDown(document.body, { key: '3', metaKey: true });
|
||||
expect(mocks.planner.handleTabChange).toHaveBeenCalledWith('buchungen');
|
||||
|
||||
fireEvent.keyDown(document.body, { key: 'ArrowRight', altKey: true });
|
||||
expect(mocks.planner.handleSelectDay).toHaveBeenCalledWith(13, true);
|
||||
fireEvent.keyDown(document.body, { key: 'ArrowLeft', altKey: true });
|
||||
expect(mocks.planner.handleSelectDay).toHaveBeenCalledWith(11, true);
|
||||
|
||||
fireEvent.keyDown(document.body, { key: 's', metaKey: true, ctrlKey: true });
|
||||
expect(shellApi().paneOpen).toBe(false);
|
||||
|
||||
fireEvent.keyDown(document.body, { key: '[', metaKey: true });
|
||||
expect(mocks.planner.navigate).toHaveBeenCalledWith('/dashboard');
|
||||
});
|
||||
|
||||
it('FE-MOB-SHELLW-006: the phone keeps its dock and its full-screen plan', () => {
|
||||
renderShell();
|
||||
expect(screen.queryByRole('navigation', { name: 'Trip sections' })).not.toBeInTheDocument();
|
||||
expect(shellApi().paneOpen).toBe(false);
|
||||
expect(shellApi().mapFront).toBe(false);
|
||||
expect(screen.getByRole('button', { name: 'mobileTrip.mapView' })).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -4,6 +4,13 @@ import { resolve } from 'node:path';
|
||||
import { renderHook, act } from '@testing-library/react';
|
||||
import { useIsPhone, isPhoneViewport, PHONE_QUERY } from '../../../src/mobile/useIsPhone';
|
||||
|
||||
const native = vi.hoisted(() => ({ app: false }));
|
||||
vi.mock('../../../src/native/platform', () => ({
|
||||
isNativeApp: () => native.app,
|
||||
isNativeIos: () => native.app,
|
||||
nativeServerHost: () => null,
|
||||
}));
|
||||
|
||||
// FE-MOB-PHONE-001 onwards
|
||||
|
||||
type ChangeListener = (e: { matches: boolean }) => void;
|
||||
@@ -24,6 +31,17 @@ const originalMatchMedia = window.matchMedia;
|
||||
describe('useIsPhone', () => {
|
||||
afterEach(() => {
|
||||
window.matchMedia = originalMatchMedia;
|
||||
native.app = false;
|
||||
});
|
||||
|
||||
it('FE-MOB-PHONE-007: the app shows the touch shell at every size, an iPad and an unfolded foldable included', () => {
|
||||
native.app = true;
|
||||
mockMatchMedia(false);
|
||||
expect(isPhoneViewport()).toBe(true);
|
||||
const { result } = renderHook(() => useIsPhone());
|
||||
expect(result.current).toBe(true);
|
||||
// Nothing to follow: a rotation or a fold must never swap the route tree.
|
||||
expect(window.matchMedia).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('FE-MOB-PHONE-001: returns true when the viewport matches the phone query', () => {
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'مذكرات السفر',
|
||||
'mobileNav.collectionsSub': 'الأماكن المحفوظة',
|
||||
'mobileNav.more': 'المزيد',
|
||||
'mobileNav.navigation': 'التنقل',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -112,5 +112,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'الخرائط',
|
||||
'mobileTrip.openRouteIn': 'افتح اليوم في',
|
||||
'mobileTrip.firstStopOnly': 'المحطة الأولى فقط',
|
||||
'mobileTrip.sections': 'أقسام الرحلة',
|
||||
'mobileTrip.hidePane': 'إخفاء الشريط الجانبي',
|
||||
'mobileTrip.showPane': 'إظهار الشريط الجانبي',
|
||||
'mobileTrip.previousDay': 'اليوم السابق',
|
||||
'mobileTrip.nextDay': 'اليوم التالي',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Səyahət gündəliyi',
|
||||
'mobileNav.collectionsSub': 'Saxlanılan məkanlar',
|
||||
'mobileNav.more': 'Daha çox',
|
||||
'mobileNav.navigation': 'Naviqasiya',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -84,6 +84,11 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Xəritələr',
|
||||
'mobileTrip.openRouteIn': 'Günü burada aç',
|
||||
'mobileTrip.firstStopOnly': 'Yalnız ilk dayanacaq',
|
||||
'mobileTrip.sections': 'Səfər bölmələri',
|
||||
'mobileTrip.hidePane': 'Yan paneli gizlət',
|
||||
'mobileTrip.showPane': 'Yan paneli göstər',
|
||||
'mobileTrip.previousDay': 'Əvvəlki gün',
|
||||
'mobileTrip.nextDay': 'Növbəti gün',
|
||||
};
|
||||
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Diário de viagem',
|
||||
'mobileNav.collectionsSub': 'Lugares salvos',
|
||||
'mobileNav.more': 'Mais',
|
||||
'mobileNav.navigation': 'Navegação',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -84,5 +84,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Mapas',
|
||||
'mobileTrip.openRouteIn': 'Abrir o dia em',
|
||||
'mobileTrip.firstStopOnly': 'Só a primeira parada',
|
||||
'mobileTrip.sections': 'Seções da viagem',
|
||||
'mobileTrip.hidePane': 'Ocultar barra lateral',
|
||||
'mobileTrip.showPane': 'Mostrar barra lateral',
|
||||
'mobileTrip.previousDay': 'Dia anterior',
|
||||
'mobileTrip.nextDay': 'Próximo dia',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Diari de viatge',
|
||||
'mobileNav.collectionsSub': 'Llocs desats',
|
||||
'mobileNav.more': 'Més',
|
||||
'mobileNav.navigation': 'Navegació',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -84,6 +84,11 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Mapes',
|
||||
'mobileTrip.openRouteIn': 'Obre el dia a',
|
||||
'mobileTrip.firstStopOnly': 'Només la primera parada',
|
||||
'mobileTrip.sections': 'Seccions del viatge',
|
||||
'mobileTrip.hidePane': 'Amaga la barra lateral',
|
||||
'mobileTrip.showPane': 'Mostra la barra lateral',
|
||||
'mobileTrip.previousDay': 'Dia anterior',
|
||||
'mobileTrip.nextDay': 'Dia següent',
|
||||
};
|
||||
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Cestovní deník',
|
||||
'mobileNav.collectionsSub': 'Uložená místa',
|
||||
'mobileNav.more': 'Více',
|
||||
'mobileNav.navigation': 'Navigace',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -92,5 +92,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Mapy',
|
||||
'mobileTrip.openRouteIn': 'Otevřít den v',
|
||||
'mobileTrip.firstStopOnly': 'Jen první zastávka',
|
||||
'mobileTrip.sections': 'Části cesty',
|
||||
'mobileTrip.hidePane': 'Skrýt postranní panel',
|
||||
'mobileTrip.showPane': 'Zobrazit postranní panel',
|
||||
'mobileTrip.previousDay': 'Předchozí den',
|
||||
'mobileTrip.nextDay': 'Další den',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Reisetagebuch',
|
||||
'mobileNav.collectionsSub': 'Gespeicherte Orte',
|
||||
'mobileNav.more': 'Mehr',
|
||||
'mobileNav.navigation': 'Navigation', // same-as-en
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -84,5 +84,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Karten',
|
||||
'mobileTrip.openRouteIn': 'Tag öffnen in',
|
||||
'mobileTrip.firstStopOnly': 'Nur der erste Halt',
|
||||
'mobileTrip.sections': 'Bereiche der Reise',
|
||||
'mobileTrip.hidePane': 'Seitenleiste ausblenden',
|
||||
'mobileTrip.showPane': 'Seitenleiste einblenden',
|
||||
'mobileTrip.previousDay': 'Vorheriger Tag',
|
||||
'mobileTrip.nextDay': 'Nächster Tag',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Travel journal',
|
||||
'mobileNav.collectionsSub': 'Saved places',
|
||||
'mobileNav.more': 'More',
|
||||
'mobileNav.navigation': 'Navigation',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -82,5 +82,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Maps',
|
||||
'mobileTrip.openRouteIn': 'Open the day in',
|
||||
'mobileTrip.firstStopOnly': 'First stop only',
|
||||
'mobileTrip.sections': 'Trip sections',
|
||||
'mobileTrip.hidePane': 'Hide sidebar',
|
||||
'mobileTrip.showPane': 'Show sidebar',
|
||||
'mobileTrip.previousDay': 'Previous day',
|
||||
'mobileTrip.nextDay': 'Next day',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Diario de viaje',
|
||||
'mobileNav.collectionsSub': 'Lugares guardados',
|
||||
'mobileNav.more': 'Más',
|
||||
'mobileNav.navigation': 'Navegación',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -84,5 +84,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Mapas',
|
||||
'mobileTrip.openRouteIn': 'Abrir el día en',
|
||||
'mobileTrip.firstStopOnly': 'Solo la primera parada',
|
||||
'mobileTrip.sections': 'Secciones del viaje',
|
||||
'mobileTrip.hidePane': 'Ocultar barra lateral',
|
||||
'mobileTrip.showPane': 'Mostrar barra lateral',
|
||||
'mobileTrip.previousDay': 'Día anterior',
|
||||
'mobileTrip.nextDay': 'Día siguiente',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Reisipäevik',
|
||||
'mobileNav.collectionsSub': 'Salvestatud kohad',
|
||||
'mobileNav.more': 'Veel',
|
||||
'mobileNav.navigation': 'Navigeerimine',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -84,5 +84,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Kaardid',
|
||||
'mobileTrip.openRouteIn': 'Ava päev rakenduses',
|
||||
'mobileTrip.firstStopOnly': 'Ainult esimene peatus',
|
||||
'mobileTrip.sections': 'Reisi jaotised',
|
||||
'mobileTrip.hidePane': 'Peida külgriba',
|
||||
'mobileTrip.showPane': 'Näita külgriba',
|
||||
'mobileTrip.previousDay': 'Eelmine päev',
|
||||
'mobileTrip.nextDay': 'Järgmine päev',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Carnet de voyage',
|
||||
'mobileNav.collectionsSub': 'Lieux enregistrés',
|
||||
'mobileNav.more': 'Plus',
|
||||
'mobileNav.navigation': 'Navigation', // same-as-en
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -84,5 +84,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Cartes',
|
||||
'mobileTrip.openRouteIn': 'Ouvrir la journée dans',
|
||||
'mobileTrip.firstStopOnly': 'Premier arrêt seulement',
|
||||
'mobileTrip.sections': 'Sections du voyage',
|
||||
'mobileTrip.hidePane': 'Masquer la barre latérale',
|
||||
'mobileTrip.showPane': 'Afficher la barre latérale',
|
||||
'mobileTrip.previousDay': 'Jour précédent',
|
||||
'mobileTrip.nextDay': 'Jour suivant',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Ημερολόγιο ταξιδιού',
|
||||
'mobileNav.collectionsSub': 'Αποθηκευμένες τοποθεσίες',
|
||||
'mobileNav.more': 'Περισσότερα',
|
||||
'mobileNav.navigation': 'Πλοήγηση',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -84,5 +84,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Χάρτες',
|
||||
'mobileTrip.openRouteIn': 'Άνοιγμα της ημέρας σε',
|
||||
'mobileTrip.firstStopOnly': 'Μόνο η πρώτη στάση',
|
||||
'mobileTrip.sections': 'Ενότητες ταξιδιού',
|
||||
'mobileTrip.hidePane': 'Απόκρυψη πλαϊνής στήλης',
|
||||
'mobileTrip.showPane': 'Εμφάνιση πλαϊνής στήλης',
|
||||
'mobileTrip.previousDay': 'Προηγούμενη ημέρα',
|
||||
'mobileTrip.nextDay': 'Επόμενη ημέρα',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'יומן מסע',
|
||||
'mobileNav.collectionsSub': 'מקומות שמורים',
|
||||
'mobileNav.more': 'עוד',
|
||||
'mobileNav.navigation': 'ניווט',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -88,6 +88,11 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'מפות',
|
||||
'mobileTrip.openRouteIn': 'פתיחת היום ב־',
|
||||
'mobileTrip.firstStopOnly': 'רק העצירה הראשונה',
|
||||
'mobileTrip.sections': 'חלקי הטיול',
|
||||
'mobileTrip.hidePane': 'הסתרת סרגל הצד',
|
||||
'mobileTrip.showPane': 'הצגת סרגל הצד',
|
||||
'mobileTrip.previousDay': 'היום הקודם',
|
||||
'mobileTrip.nextDay': 'היום הבא',
|
||||
};
|
||||
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Úti napló',
|
||||
'mobileNav.collectionsSub': 'Mentett helyek',
|
||||
'mobileNav.more': 'Több',
|
||||
'mobileNav.navigation': 'Navigáció',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -84,5 +84,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Térképek',
|
||||
'mobileTrip.openRouteIn': 'Nap megnyitása ebben',
|
||||
'mobileTrip.firstStopOnly': 'Csak az első megálló',
|
||||
'mobileTrip.sections': 'Az utazás részei',
|
||||
'mobileTrip.hidePane': 'Oldalsáv elrejtése',
|
||||
'mobileTrip.showPane': 'Oldalsáv megjelenítése',
|
||||
'mobileTrip.previousDay': 'Előző nap',
|
||||
'mobileTrip.nextDay': 'Következő nap',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Jurnal perjalanan',
|
||||
'mobileNav.collectionsSub': 'Tempat tersimpan',
|
||||
'mobileNav.more': 'Lainnya',
|
||||
'mobileNav.navigation': 'Navigasi',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -76,5 +76,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Peta',
|
||||
'mobileTrip.openRouteIn': 'Buka hari ini di',
|
||||
'mobileTrip.firstStopOnly': 'Hanya perhentian pertama',
|
||||
'mobileTrip.sections': 'Bagian perjalanan',
|
||||
'mobileTrip.hidePane': 'Sembunyikan bilah samping',
|
||||
'mobileTrip.showPane': 'Tampilkan bilah samping',
|
||||
'mobileTrip.previousDay': 'Hari sebelumnya',
|
||||
'mobileTrip.nextDay': 'Hari berikutnya',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Diario di viaggio',
|
||||
'mobileNav.collectionsSub': 'Luoghi salvati',
|
||||
'mobileNav.more': 'Altro',
|
||||
'mobileNav.navigation': 'Navigazione',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -84,5 +84,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Mappe',
|
||||
'mobileTrip.openRouteIn': 'Apri la giornata in',
|
||||
'mobileTrip.firstStopOnly': 'Solo la prima tappa',
|
||||
'mobileTrip.sections': 'Sezioni del viaggio',
|
||||
'mobileTrip.hidePane': 'Nascondi barra laterale',
|
||||
'mobileTrip.showPane': 'Mostra barra laterale',
|
||||
'mobileTrip.previousDay': 'Giorno precedente',
|
||||
'mobileTrip.nextDay': 'Giorno successivo',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': '旅行日記',
|
||||
'mobileNav.collectionsSub': '保存した場所',
|
||||
'mobileNav.more': 'その他',
|
||||
'mobileNav.navigation': 'ナビゲーション',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -74,5 +74,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'マップ',
|
||||
'mobileTrip.openRouteIn': 'この日を開くアプリ',
|
||||
'mobileTrip.firstStopOnly': '最初の立ち寄り先のみ',
|
||||
'mobileTrip.sections': '旅行のセクション',
|
||||
'mobileTrip.hidePane': 'サイドバーを非表示',
|
||||
'mobileTrip.showPane': 'サイドバーを表示',
|
||||
'mobileTrip.previousDay': '前の日',
|
||||
'mobileTrip.nextDay': '次の日',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': '여행 일기',
|
||||
'mobileNav.collectionsSub': '저장한 장소',
|
||||
'mobileNav.more': '더 보기',
|
||||
'mobileNav.navigation': '탐색',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -75,5 +75,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': '지도',
|
||||
'mobileTrip.openRouteIn': '이 날을 열 앱',
|
||||
'mobileTrip.firstStopOnly': '첫 번째 장소만',
|
||||
'mobileTrip.sections': '여행 섹션',
|
||||
'mobileTrip.hidePane': '사이드바 숨기기',
|
||||
'mobileTrip.showPane': '사이드바 보기',
|
||||
'mobileTrip.previousDay': '이전 날',
|
||||
'mobileTrip.nextDay': '다음 날',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Reisdagboek',
|
||||
'mobileNav.collectionsSub': 'Opgeslagen plaatsen',
|
||||
'mobileNav.more': 'Meer',
|
||||
'mobileNav.navigation': 'Navigatie',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -83,5 +83,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Kaarten',
|
||||
'mobileTrip.openRouteIn': 'Dag openen in',
|
||||
'mobileTrip.firstStopOnly': 'Alleen de eerste stop',
|
||||
'mobileTrip.sections': 'Onderdelen van de reis',
|
||||
'mobileTrip.hidePane': 'Zijbalk verbergen',
|
||||
'mobileTrip.showPane': 'Zijbalk tonen',
|
||||
'mobileTrip.previousDay': 'Vorige dag',
|
||||
'mobileTrip.nextDay': 'Volgende dag',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Dziennik podróży',
|
||||
'mobileNav.collectionsSub': 'Zapisane miejsca',
|
||||
'mobileNav.more': 'Więcej',
|
||||
'mobileNav.navigation': 'Nawigacja',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -100,5 +100,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Mapy',
|
||||
'mobileTrip.openRouteIn': 'Otwórz dzień w',
|
||||
'mobileTrip.firstStopOnly': 'Tylko pierwszy przystanek',
|
||||
'mobileTrip.sections': 'Sekcje podróży',
|
||||
'mobileTrip.hidePane': 'Ukryj pasek boczny',
|
||||
'mobileTrip.showPane': 'Pokaż pasek boczny',
|
||||
'mobileTrip.previousDay': 'Poprzedni dzień',
|
||||
'mobileTrip.nextDay': 'Następny dzień',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Дневник путешествий',
|
||||
'mobileNav.collectionsSub': 'Сохранённые места',
|
||||
'mobileNav.more': 'Ещё',
|
||||
'mobileNav.navigation': 'Навигация',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -100,5 +100,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Карты',
|
||||
'mobileTrip.openRouteIn': 'Открыть день в',
|
||||
'mobileTrip.firstStopOnly': 'Только первая остановка',
|
||||
'mobileTrip.sections': 'Разделы поездки',
|
||||
'mobileTrip.hidePane': 'Скрыть боковую панель',
|
||||
'mobileTrip.showPane': 'Показать боковую панель',
|
||||
'mobileTrip.previousDay': 'Предыдущий день',
|
||||
'mobileTrip.nextDay': 'Следующий день',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Cestovný denník',
|
||||
'mobileNav.collectionsSub': 'Uložené miesta',
|
||||
'mobileNav.more': 'Viac',
|
||||
'mobileNav.navigation': 'Navigácia',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -92,5 +92,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Mapy',
|
||||
'mobileTrip.openRouteIn': 'Otvoriť deň v',
|
||||
'mobileTrip.firstStopOnly': 'Len prvá zastávka',
|
||||
'mobileTrip.sections': 'Časti cesty',
|
||||
'mobileTrip.hidePane': 'Skryť bočný panel',
|
||||
'mobileTrip.showPane': 'Zobraziť bočný panel',
|
||||
'mobileTrip.previousDay': 'Predchádzajúci deň',
|
||||
'mobileTrip.nextDay': 'Nasledujúci deň',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Resedagbok',
|
||||
'mobileNav.collectionsSub': 'Sparade platser',
|
||||
'mobileNav.more': 'Mer',
|
||||
'mobileNav.navigation': 'Navigering',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -83,5 +83,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Kartor',
|
||||
'mobileTrip.openRouteIn': 'Öppna dagen i',
|
||||
'mobileTrip.firstStopOnly': 'Bara första stoppet',
|
||||
'mobileTrip.sections': 'Resans delar',
|
||||
'mobileTrip.hidePane': 'Dölj sidofältet',
|
||||
'mobileTrip.showPane': 'Visa sidofältet',
|
||||
'mobileTrip.previousDay': 'Föregående dag',
|
||||
'mobileTrip.nextDay': 'Nästa dag',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'บันทึกการเดินทาง',
|
||||
'mobileNav.collectionsSub': 'สถานที่ที่บันทึกไว้',
|
||||
'mobileNav.more': 'เพิ่มเติม',
|
||||
'mobileNav.navigation': 'การนำทาง',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -74,5 +74,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'แผนที่',
|
||||
'mobileTrip.openRouteIn': 'เปิดวันนี้ใน',
|
||||
'mobileTrip.firstStopOnly': 'เฉพาะจุดแรก',
|
||||
'mobileTrip.sections': 'ส่วนต่างๆ ของทริป',
|
||||
'mobileTrip.hidePane': 'ซ่อนแถบด้านข้าง',
|
||||
'mobileTrip.showPane': 'แสดงแถบด้านข้าง',
|
||||
'mobileTrip.previousDay': 'วันก่อนหน้า',
|
||||
'mobileTrip.nextDay': 'วันถัดไป',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
@@ -4,6 +4,7 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.journeySub': 'Seyahat günlüğü',
|
||||
'mobileNav.collectionsSub': 'Kaydedilen yerler',
|
||||
'mobileNav.more': 'Daha fazla',
|
||||
'mobileNav.navigation': 'Gezinme',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -83,5 +83,10 @@ const mobileTrip: TranslationStrings = {
|
||||
'mobileTrip.maps': 'Haritalar',
|
||||
'mobileTrip.openRouteIn': 'Günü şurada aç',
|
||||
'mobileTrip.firstStopOnly': 'Yalnızca ilk durak',
|
||||
'mobileTrip.sections': 'Seyahat bölümleri',
|
||||
'mobileTrip.hidePane': 'Kenar çubuğunu gizle',
|
||||
'mobileTrip.showPane': 'Kenar çubuğunu göster',
|
||||
'mobileTrip.previousDay': 'Önceki gün',
|
||||
'mobileTrip.nextDay': 'Sonraki gün',
|
||||
};
|
||||
export default mobileTrip;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user