feat(mobile): page transitions, pull-to-refresh, share sheet and haptics

Page transitions: on the phone, pages move like a native navigation stack,
built on the View Transitions API (mobile/routeTransition.ts). A page opened
from another slides in from the trailing edge, back slides it away, and
switching between the dock's sections cross-fades while the dock stands
still. Lazy routes do not flash their skeleton: the swap waits, behind the
frozen snapshot, until the new page rendered. The edge-swipe back gesture
already moves the page and skips the transition. RTL mirrors the motion,
reduced motion and desktop get none.

Pull-to-refresh on the mobile dashboard: the page follows the finger with
resistance, ticks once past the threshold and re-reads trips and
notifications quietly, without a loading state.

Share: trip share and invite links and the journey link get a share button
next to copy, opening the system share sheet (Capacitor Share in the apps,
Web Share in browsers that have it).

Haptics: a selection click for switches and segmented controls, a tick when
a sheet is flung closed, and a firmer bump for the chat's long press.

Theme lint: this branch's new screens use the type and z-index tokens, the
Vacay company tint is a token, and the baseline is lowered to the new
counts.
This commit is contained in:
Maurice
2026-11-06 14:49:26 +01:00
parent 3c4c880c31
commit 6835fd7bf3
57 changed files with 699 additions and 43 deletions
+1 -1
View File
@@ -120,7 +120,7 @@ export default function MBottomNav() {
</div>
)}
<nav className="fixed inset-x-4 z-40 flex h-[62px] items-center rounded-[31px] border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] px-3 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)]">
<nav className="m-dock-vt fixed inset-x-4 z-40 flex h-[62px] items-center rounded-[31px] border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] px-3 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)]">
<div className="flex min-w-0 flex-1 items-center justify-around">{left.map(renderItem)}</div>
{logoSlot ? (
@@ -2,6 +2,7 @@ import type { RefObject } from 'react';
import { useEffect } from 'react';
import { tickHaptic } from '../../native/haptics';
import { closeTopOverlay, hasOpenOverlay } from '../overlayStack';
import { skipNextRouteTransition } from '../routeTransition';
/**
* The swipe from the left edge that goes back, the way every iOS app has it.
@@ -96,6 +97,7 @@ export default function MEdgeBack({ target, enabled }: { target: RefObject<HTMLE
}
move(width, 'transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1)');
window.setTimeout(() => {
skipNextRouteTransition();
window.history.back();
// The page that comes back takes the place without a slide of its own.
requestAnimationFrame(() => move(0, 'none'));
@@ -0,0 +1,29 @@
import { RefreshCw } from 'lucide-react';
import { PULL_THRESHOLD, type PullState } from '../usePullToRefresh';
/**
* The round glass badge under the top bar that a pull-to-refresh reveals: it
* fades in and turns with the pull, and spins while the page reloads.
*/
export default function MPullIndicator({ state, label }: { state: PullState; label: string }) {
const progress = Math.min(1, state.distance / PULL_THRESHOLD);
const visible = state.refreshing || state.distance > 4;
return (
<div
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"
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">
<RefreshCw
size={16}
strokeWidth={2.2}
className={state.refreshing ? 'animate-spin' : undefined}
style={state.refreshing ? undefined : { transform: `rotate(${progress * 270}deg)` }}
/>
</span>
</div>
);
}
@@ -9,7 +9,7 @@
*/
export default function MRouteFallback() {
return (
<div className="m-root flex h-dvh flex-col gap-3 px-4 pt-14 bg-[color:var(--m-bg)]">
<div data-route-fallback className="m-root flex h-dvh flex-col gap-3 px-4 pt-14 bg-[color:var(--m-bg)]">
<div className="h-7 w-40 animate-pulse rounded-lg bg-m-card" />
<div className="h-28 animate-pulse rounded-xl bg-m-card" />
<div className="h-28 animate-pulse rounded-xl bg-m-card" />
+5 -1
View File
@@ -1,5 +1,6 @@
import { ReactNode, useRef } from 'react'
import { useActivePill } from './useActivePill'
import { selectionHaptic } from '../../native/haptics'
export interface MSegmentedOption<T extends string = string> {
value: T
@@ -45,7 +46,10 @@ export default function MSegmented<T extends string = string>({
role="tab"
aria-selected={active}
data-active={active}
onClick={() => onChange(opt.value)}
onClick={() => {
if (!active) selectionHaptic()
onChange(opt.value)
}}
className={`relative z-[1] rounded-full py-[7px] text-center ${
variant === 'intrinsic'
? 'whitespace-nowrap px-[11px] text-[0.75rem]'
+2
View File
@@ -6,6 +6,7 @@ import { useDiscardGuard } from '../../components/shared/useDiscardGuard'
import { keepTabInside, useModalFocus } from './modalFocus'
import { useSheetDrag } from './useSheetDrag'
import { useOverlay } from '../overlayStack'
import { tickHaptic } from '../../native/haptics'
export type MSheetVariant = 'card' | 'bottom' | 'drawer'
export type MSheetMaterial = 'glass' | 'bar-glass' | 'opaque'
@@ -106,6 +107,7 @@ export default function MSheet({
return false
}
setFlung(true)
tickHaptic()
onClose()
return true
},
+5 -1
View File
@@ -1,3 +1,4 @@
import { selectionHaptic } from '../../native/haptics'
interface MToggleProps {
checked: boolean
onChange: (checked: boolean) => void
@@ -15,7 +16,10 @@ export default function MToggle({ checked, onChange, ariaLabel, disabled = false
aria-checked={checked}
aria-label={ariaLabel}
disabled={disabled}
onClick={() => onChange(!checked)}
onClick={() => {
selectionHaptic()
onChange(!checked)
}}
className={`box-border h-[22px] w-10 flex-none rounded-full p-[2px] transition-colors duration-[180ms] disabled:opacity-50 ${
checked ? 'bg-m-act' : 'bg-[color:var(--m-trackoff)]'
} ${className}`}