mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 19:40:34 +00:00
fix(mobile): the rail, the docks and the top-level screens on a large screen
From the large-screen review (visual findings of the shell and the top-level screens): - Rail: 80px wide, one caption size for every name (no shrinking per item), balanced two-line names with every entry as tall as the tallest, short rail names where a language's word is too long (mobileNav.rail*, all locales), and near-opaque glass so a map's colours no longer smear through it. - Rail head: always one 56px circle, so the entries never jump between pages: the create action, the screen's own action (the vacation calendar's year/editor switch moves there instead of floating over the days) or the quiet logo on settings and administration. It stays put while a short rail scrolls. - Vacation calendar: weekday letters over each month on a wide window; the editor's mode switch sits at the foot with room kept for it. - Docks: More is marked with a ring rather than the centre button's fill, the dock glass is denser, and lists fade out under the dock instead of showing in the gap below it. - Dashboard: trip names get the card's width with the dates under them, the hero's facts wrap as whole chips, the filter chips scroll with a fade, the hero ends above the dock on a phone on its side and its buttons sit on a dark ground; the header bar stands in the content's column. - Journeys: on a wide window the header is the same glass bar, in the column of the cards, and the other journeys' label starts with them. - Notifications: the round chevron back button, in the list's column. - Settings and administration share one frame and width. Admin's new-user action sits under the section list's title, the users card header wraps inside the card, stat labels ellipsize, role badges read in dark mode. - Collections: one card per place with the status inside it, worded in a readable mix of its colour. - Atlas and the journey map frame clear of the rail and the header; the journey's day bar sits on a glass plate, and a phone on its side gets smaller cards. - Rail label tests rewritten for the new rule; FE-MOB-PANES-016 duplicate renumbered to 017.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
"src/pages/JourneyDetailPage.test.tsx": 4028,
|
||||
"src/pages/LoginPage.tsx": 1347,
|
||||
"src/pages/TripPlannerPage.tsx": 1128,
|
||||
"src/pages/atlas/useAtlas.ts": 1210,
|
||||
"src/pages/atlas/useAtlas.ts": 1207,
|
||||
"src/pages/tripPlanner/useTripPlanner.roadtrip.test.tsx": 3518,
|
||||
"src/pages/tripPlanner/useTripPlanner.test.tsx": 3270,
|
||||
"src/styles/studio.css": 1918
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
"mobile/screens/collections/MCollTripPickerSheet.tsx": 4,
|
||||
"mobile/screens/collections/MCollections.tsx": 14,
|
||||
"mobile/screens/dashboard/MDashWidgets.tsx": 22,
|
||||
"mobile/screens/dashboard/MDashboard.tsx": 31,
|
||||
"mobile/screens/dashboard/MDashboard.tsx": 30,
|
||||
"mobile/screens/dashboard/MNewTripSheet.tsx": 12,
|
||||
"mobile/screens/dashboard/MUserMenu.tsx": 7,
|
||||
"mobile/screens/journey/MJourney.tsx": 10,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// FE-COMP-JOURNEYMAP-001 to FE-COMP-JOURNEYMAP-062
|
||||
// FE-COMP-JOURNEYMAP-001 to FE-COMP-JOURNEYMAP-063
|
||||
|
||||
vi.mock('../../api/websocket', () => ({
|
||||
connect: vi.fn(),
|
||||
@@ -592,6 +592,28 @@ describe('JourneyMap', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('FE-COMP-JOURNEYMAP-063: paddingStart keeps the journey clear of a rail on the leading side, either way round', () => {
|
||||
const origRAF = globalThis.requestAnimationFrame;
|
||||
globalThis.requestAnimationFrame = (cb: FrameRequestCallback) => { cb(0); return 0; };
|
||||
try {
|
||||
const { unmount } = render(<JourneyMap checkins={[]} entries={entriesWithCoords} paddingBottom={200} paddingStart={100} />);
|
||||
expect(mockedMap().fitBounds).toHaveBeenLastCalledWith(
|
||||
expect.anything(),
|
||||
expect.objectContaining({ paddingTopLeft: [150, 50], paddingBottomRight: [50, 200] }),
|
||||
);
|
||||
unmount();
|
||||
document.documentElement.dir = 'rtl';
|
||||
render(<JourneyMap checkins={[]} entries={entriesWithCoords} paddingBottom={200} paddingStart={100} />);
|
||||
expect(mockedMap().fitBounds).toHaveBeenLastCalledWith(
|
||||
expect.anything(),
|
||||
expect.objectContaining({ paddingTopLeft: [50, 50], paddingBottomRight: [150, 200] }),
|
||||
);
|
||||
} finally {
|
||||
document.documentElement.dir = '';
|
||||
globalThis.requestAnimationFrame = origRAF;
|
||||
}
|
||||
});
|
||||
|
||||
it('FE-COMP-JOURNEYMAP-026: dark mode picks the dark basemap', async () => {
|
||||
render(<JourneyMap checkins={[]} entries={entriesWithCoords} dark />);
|
||||
// The default basemap is a vector style now, so it arrives as a style option
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useRef, useImperativeHandle, useCallback, type CSSProperties, type Ref, type RefObject } from 'react'
|
||||
import { useEffect, useLayoutEffect, useRef, useImperativeHandle, useCallback, type CSSProperties, type Ref, type RefObject } from 'react'
|
||||
import { clusterPhotos, photoMarkerHtml, type MapPhoto } from './journeyPhotoLayer'
|
||||
import L from 'leaflet'
|
||||
import { useSettingsStore } from '../../store/settingsStore'
|
||||
@@ -76,6 +76,12 @@ interface Props {
|
||||
*/
|
||||
onMarkerCardClick?: (entryId: string) => void
|
||||
paddingBottom?: number
|
||||
/**
|
||||
* How much of the map's leading edge a bar laid over it covers (the touch
|
||||
* shell's rail), in px: framing keeps the journey clear of it. Read when the
|
||||
* map frames, so a change alone does not rebuild the map.
|
||||
*/
|
||||
paddingStart?: number
|
||||
/** CARTO key from the share payload: the public journey has no settings store to read. */
|
||||
cartoApiKey?: string
|
||||
/**
|
||||
@@ -281,13 +287,23 @@ function markCoords(marks: JourneyMapMark[] | undefined): L.LatLngTuple[] {
|
||||
return (marks ?? []).map(mark => [mark.lat, mark.lng] as L.LatLngTuple)
|
||||
}
|
||||
|
||||
function fitOptions(paddingBottom: number | undefined): L.FitBoundsOptions {
|
||||
return { paddingTopLeft: [50, 50], paddingBottomRight: [50, paddingBottom || 50], maxZoom: 16 }
|
||||
function fitOptions(paddingBottom: number | undefined, paddingStart = 0): L.FitBoundsOptions {
|
||||
const rtl = typeof document !== 'undefined' && document.documentElement.dir === 'rtl'
|
||||
return {
|
||||
paddingTopLeft: [50 + (rtl ? 0 : paddingStart), 50],
|
||||
paddingBottomRight: [50 + (rtl ? paddingStart : 0), paddingBottom || 50],
|
||||
maxZoom: 16,
|
||||
}
|
||||
}
|
||||
|
||||
function JourneyMap(
|
||||
{ entries, photos, onPhotoClick, trail, tracks, height = 220, dark, activeMarkerId, onMarkerClick, fullScreen, paddingBottom, cartoApiKey, onMarkerCardClick, layerVisibility = EVERY_LAYER, marks, onMarksPick, plannedEntryIds = NO_PLANNED, ref }: Props,
|
||||
{ entries, photos, onPhotoClick, trail, tracks, height = 220, dark, activeMarkerId, onMarkerClick, fullScreen, paddingBottom, paddingStart = 0, cartoApiKey, onMarkerCardClick, layerVisibility = EVERY_LAYER, marks, onMarksPick, plannedEntryIds = NO_PLANNED, ref }: Props,
|
||||
) {
|
||||
// The leading inset is read when the map frames, not a reason to rebuild it.
|
||||
const paddingStartRef = useRef(paddingStart)
|
||||
useLayoutEffect(() => {
|
||||
paddingStartRef.current = paddingStart
|
||||
})
|
||||
// Read through a ref: the handler is fixed per surface, and putting it in the
|
||||
// marker effect's deps would rebuild every marker for nothing.
|
||||
const onMarkerCardClickRef = useRef(onMarkerCardClick)
|
||||
@@ -536,7 +552,7 @@ function JourneyMap(
|
||||
const pointCoords = [...allCoords, ...markCoords(marksRef.current)]
|
||||
const fitCoords = pointCoords.length > 0 ? pointCoords : trackCoords
|
||||
marksFramedRef.current = (marksRef.current?.length ?? 0) > 0
|
||||
if (fitCoords.length > 0) map.fitBounds(L.latLngBounds(fitCoords), fitOptions(paddingBottom))
|
||||
if (fitCoords.length > 0) map.fitBounds(L.latLngBounds(fitCoords), fitOptions(paddingBottom, paddingStartRef.current))
|
||||
else map.setView([30, 0], 2)
|
||||
} catch {}
|
||||
})
|
||||
@@ -652,7 +668,7 @@ function JourneyMap(
|
||||
const coords = markCoords(marks)
|
||||
if (!marksFramedRef.current && coords.length > 0) {
|
||||
marksFramedRef.current = true
|
||||
if (!readerMovedRef.current) map.fitBounds(L.latLngBounds([...entryCoordsRef.current, ...coords]), fitOptions(paddingBottom))
|
||||
if (!readerMovedRef.current) map.fitBounds(L.latLngBounds([...entryCoordsRef.current, ...coords]), fitOptions(paddingBottom, paddingStartRef.current))
|
||||
}
|
||||
|
||||
draw()
|
||||
|
||||
@@ -39,6 +39,12 @@ interface Props {
|
||||
onMarkerClick?: (id: string, type?: string) => void
|
||||
fullScreen?: boolean
|
||||
paddingBottom?: number
|
||||
/**
|
||||
* How much of the map's leading edge a bar laid over it covers (the touch
|
||||
* shell's rail), in px: framing keeps the journey clear of it. Read when the
|
||||
* map frames, so a change alone does not rebuild the map.
|
||||
*/
|
||||
paddingStart?: number
|
||||
/** Open the entry a marker card names when the card is tapped, both renderers. */
|
||||
onMarkerCardClick?: (entryId: string) => void
|
||||
/** Open an entry's photos from the marker card's thumbnail strip. GL renderer only. */
|
||||
|
||||
@@ -317,6 +317,14 @@ describe('JourneyMapGL', () => {
|
||||
expect(gl.map.addLayer).toHaveBeenCalledWith(expect.objectContaining({ id: 'journey-route-line' }))
|
||||
})
|
||||
|
||||
it('FE-COMP-JMAPGL-049: paddingStart widens the fit on the side of the rail', () => {
|
||||
withToken()
|
||||
render(<JourneyMapGL checkins={[]} entries={entries} paddingBottom={200} paddingStart={100} fullScreen />)
|
||||
expect(gl.map.fitBounds).toHaveBeenCalledWith(gl.boundsList[0], expect.objectContaining({
|
||||
padding: { top: 50, bottom: 200, left: 150, right: 50 },
|
||||
}))
|
||||
})
|
||||
|
||||
it('FE-COMP-JMAPGL-010: the camera fits entries and trail with the requested bottom padding', () => {
|
||||
withToken()
|
||||
render(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useRef, useImperativeHandle, useCallback, type Ref } from 'react'
|
||||
import { useEffect, useLayoutEffect, useRef, useImperativeHandle, useCallback, type Ref } from 'react'
|
||||
import type mapboxgl from 'mapbox-gl'
|
||||
import { useSettingsStore } from '../../store/settingsStore'
|
||||
import { isStandardFamily, supportsCustom3d, wantsTerrain, addCustom3dBuildings, addTerrainAndSky } from '../Map/mapboxSetup'
|
||||
@@ -57,6 +57,12 @@ interface Props {
|
||||
photos?: MapPhoto[]
|
||||
onPhotoClick?: (photoIds: string[]) => void
|
||||
paddingBottom?: number
|
||||
/**
|
||||
* How much of the map's leading edge a bar laid over it covers (the touch
|
||||
* shell's rail), in px: framing keeps the journey clear of it. Read when the
|
||||
* map frames, so a change alone does not rebuild the map.
|
||||
*/
|
||||
paddingStart?: number
|
||||
/** See the Leaflet twin (JRN-04): hidden layers go off the map in place. */
|
||||
layerVisibility?: JourneyMapLayerVisibility
|
||||
marks?: JourneyMapMark[]
|
||||
@@ -185,9 +191,10 @@ function markBounds(gl: Props['gl'], marks: JourneyMapMark[], points: [number, n
|
||||
return bounds
|
||||
}
|
||||
|
||||
function fitOptions(paddingBottom: number | undefined, tilted: boolean | undefined) {
|
||||
function fitOptions(paddingBottom: number | undefined, tilted: boolean | undefined, paddingStart = 0) {
|
||||
const rtl = typeof document !== 'undefined' && document.documentElement.dir === 'rtl'
|
||||
return {
|
||||
padding: { top: 50, bottom: paddingBottom || 50, left: 50, right: 50 },
|
||||
padding: { top: 50, bottom: paddingBottom || 50, left: 50 + (rtl ? 0 : paddingStart), right: 50 + (rtl ? paddingStart : 0) },
|
||||
maxZoom: 16,
|
||||
pitch: tilted ? 45 : 0,
|
||||
duration: 0,
|
||||
@@ -195,8 +202,13 @@ function fitOptions(paddingBottom: number | undefined, tilted: boolean | undefin
|
||||
}
|
||||
|
||||
function JourneyMapGL(
|
||||
{ entries, trail, tracks, height = 220, dark, activeMarkerId, onMarkerClick, fullScreen, paddingBottom, glProvider = 'mapbox-gl', gl, onMarkerCardClick, onMarkerPhotoClick, photos, onPhotoClick, layerVisibility = EVERY_LAYER, marks, onMarksPick, plannedEntryIds = NO_PLANNED, ref }: Props,
|
||||
{ entries, trail, tracks, height = 220, dark, activeMarkerId, onMarkerClick, fullScreen, paddingBottom, paddingStart = 0, glProvider = 'mapbox-gl', gl, onMarkerCardClick, onMarkerPhotoClick, photos, onPhotoClick, layerVisibility = EVERY_LAYER, marks, onMarksPick, plannedEntryIds = NO_PLANNED, ref }: Props,
|
||||
) {
|
||||
// The leading inset is read when the map frames, not a reason to rebuild it.
|
||||
const paddingStartRef = useRef(paddingStart)
|
||||
useLayoutEffect(() => {
|
||||
paddingStartRef.current = paddingStart
|
||||
})
|
||||
const onMarkerCardClickRef = useRef(onMarkerCardClick)
|
||||
onMarkerCardClickRef.current = onMarkerCardClick
|
||||
const onMarkerPhotoClickRef = useRef(onMarkerPhotoClick)
|
||||
@@ -526,7 +538,7 @@ function JourneyMapGL(
|
||||
known.forEach(mark => bounds.extend([mark.lng, mark.lat]))
|
||||
if (hasPoints || known.length > 0) {
|
||||
try {
|
||||
map.fitBounds(bounds, fitOptions(paddingBottom, enableMapbox3d && fullScreen))
|
||||
map.fitBounds(bounds, fitOptions(paddingBottom, enableMapbox3d && fullScreen, paddingStartRef.current))
|
||||
} catch { /* empty bounds */ }
|
||||
}
|
||||
})
|
||||
@@ -631,7 +643,7 @@ function JourneyMapGL(
|
||||
marksFramedRef.current = true
|
||||
if (!readerMovedRef.current) {
|
||||
try {
|
||||
map.fitBounds(markBounds(gl, marks, entryPointsRef.current), fitOptions(paddingBottom, enableMapbox3d && fullScreen))
|
||||
map.fitBounds(markBounds(gl, marks, entryPointsRef.current), fitOptions(paddingBottom, enableMapbox3d && fullScreen, paddingStartRef.current))
|
||||
} catch { /* empty bounds */ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useNavigate, useLocation } from 'react-router'
|
||||
import { useNavigate, useLocation, matchPath } from 'react-router'
|
||||
import { useSettingsStore } from '../../store/settingsStore'
|
||||
import { useTranslation } from '../../i18n'
|
||||
import { ChevronRight, MoreHorizontal, Plus, Search, Sparkles, Upload } from 'lucide-react'
|
||||
@@ -9,6 +9,7 @@ import { useNavItems, splitMobileNav } from '../../components/Layout/navItems'
|
||||
import { isNavItemActive, useCreateAction } from '../../components/Layout/useCreateAction'
|
||||
import MFab from './MFab'
|
||||
import { useAssistantHomeLauncher } from '../../components/Assistant/useAssistantHome'
|
||||
import MDockScrim from './MDockScrim'
|
||||
|
||||
interface NavItem { to: string; label: string; icon: LucideIcon }
|
||||
|
||||
@@ -72,6 +73,14 @@ export default function MBottomNav() {
|
||||
`flex h-[42px] w-[42px] flex-none items-center justify-center rounded-full ${
|
||||
active ? 'bg-m-act text-m-actfg' : 'text-m-muted'
|
||||
}`
|
||||
// More stands for whichever of its screens is on show, so it is marked as a
|
||||
// ring: a filled circle beside the filled "+" read as two of the same action.
|
||||
const moreCls = (active: boolean) =>
|
||||
`flex h-[42px] w-[42px] flex-none items-center justify-center rounded-full ${
|
||||
active ? 'bg-[color:var(--m-ic)] text-m-ink ring-[1.5px] ring-inset ring-[color:var(--m-act)]' : 'text-m-muted'
|
||||
}`
|
||||
// A map runs to the screen's edge on purpose; everything else fades out under the dock.
|
||||
const overMap = location.pathname.startsWith('/atlas') || matchPath('/journey/:id', location.pathname) !== null
|
||||
|
||||
const renderItem = ({ to, label, icon: Icon }: NavItem) => {
|
||||
const active = isActive(to)
|
||||
@@ -120,7 +129,8 @@ export default function MBottomNav() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<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)]">
|
||||
{!overMap && <MDockScrim />}
|
||||
<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-dock)] px-3 shadow-[0_16px_44px_-14px_rgba(0,0,0,.35)] backdrop-blur-[30px] backdrop-saturate-[1.4] 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 ? (
|
||||
@@ -151,7 +161,7 @@ export default function MBottomNav() {
|
||||
aria-label={t('mobileNav.more')}
|
||||
aria-expanded={moreOpen}
|
||||
aria-current={moreActive ? 'page' : undefined}
|
||||
className={circleCls(moreActive)}
|
||||
className={moreCls(moreActive)}
|
||||
>
|
||||
<MoreHorizontal size={21} strokeWidth={1.9} />
|
||||
</button>
|
||||
|
||||
@@ -3,19 +3,31 @@ import { ReactNode } from 'react'
|
||||
interface MGlassBarProps {
|
||||
/** Pins the bar below the status bar (default). Pass false to embed it in flow. */
|
||||
floating?: boolean
|
||||
/**
|
||||
* The width the screen's content column stops at on a wide window, as the
|
||||
* same class the content uses (`wide:max-w-[1280px]`). The floating bar then
|
||||
* stands in that column with the content's own padding, so their edges line
|
||||
* up at every width.
|
||||
*/
|
||||
column?: string
|
||||
className?: string
|
||||
children: ReactNode
|
||||
}
|
||||
|
||||
/** Top bar glass pill: blur 26 / saturate 1.7 on --m-glass with --m-gbr border. */
|
||||
export default function MGlassBar({ floating = true, className = '', children }: MGlassBarProps) {
|
||||
return (
|
||||
export default function MGlassBar({ floating = true, column = '', className = '', children }: MGlassBarProps) {
|
||||
const bar = (
|
||||
<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 ? 'm-bar-x fixed top-[var(--m-safe-top,12px)] z-30' : ''
|
||||
} ${className}`}
|
||||
className={`pointer-events-auto 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)] ${className}`}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
if (!floating) return bar
|
||||
// The page column (m-span-x), padded and capped like the content under it.
|
||||
return (
|
||||
<div className="m-span-x pointer-events-none fixed top-[var(--m-safe-top,12px)] z-30">
|
||||
<div className={`px-4 wide:mx-auto wide:px-6 ${column}`}>{bar}</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { useTranslation } from '../../i18n';
|
||||
import { useAuthStore } from '../../store/authStore';
|
||||
import MFab from './MFab';
|
||||
import { MRail, MRailButton, MRailSpacer } from './MRail';
|
||||
import { useRailAction } from './railAction';
|
||||
|
||||
interface RailEntry {
|
||||
id: string;
|
||||
@@ -17,16 +18,23 @@ interface RailEntry {
|
||||
go: () => void;
|
||||
}
|
||||
|
||||
const FOCUS_RING =
|
||||
'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)]';
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* The touch shell's navigation on a wide window (hooks/sizeClass.ts): a 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.
|
||||
* which the phone reaches through the avatar menu.
|
||||
*
|
||||
* Its head is always one 56px circle, so no entry moves when the page changes:
|
||||
* the create action with the dock's context-aware meaning, the screen's own
|
||||
* action where it has one (the vacation calendar's switch), or the dock's
|
||||
* quiet logo where there is nothing to create (settings, administration).
|
||||
*/
|
||||
export default function MNavRail() {
|
||||
const { t } = useTranslation();
|
||||
@@ -36,12 +44,14 @@ export default function MNavRail() {
|
||||
const assistant = useAssistantHomeLauncher();
|
||||
const isAdmin = useAuthStore((s) => s.user?.role === 'admin');
|
||||
const navItems = useNavItems();
|
||||
const screenAction = useRailAction();
|
||||
|
||||
const isActive = (to: string) => isNavItemActive(location.pathname, to);
|
||||
const main: RailEntry[] = [
|
||||
...navItems.map(({ to, label, icon }) => ({
|
||||
...navItems.map(({ id, to, label, icon }) => ({
|
||||
id: to,
|
||||
label,
|
||||
// A few names are too long for a rail in some languages; the rail has its own words for those.
|
||||
label: id === 'collections' ? t('mobileNav.railCollections') : label,
|
||||
icon,
|
||||
active: isActive(to),
|
||||
go: () => void navigate(to),
|
||||
@@ -53,7 +63,7 @@ export default function MNavRail() {
|
||||
const foot: RailEntry[] = [
|
||||
{
|
||||
id: '/settings',
|
||||
label: t('nav.bottomSettings'),
|
||||
label: t('mobileNav.railSettings'),
|
||||
icon: Settings2,
|
||||
active: isActive('/settings'),
|
||||
go: () => void navigate('/settings'),
|
||||
@@ -62,7 +72,7 @@ export default function MNavRail() {
|
||||
? [
|
||||
{
|
||||
id: '/admin',
|
||||
label: t('nav.admin'),
|
||||
label: t('mobileNav.railAdmin'),
|
||||
icon: Shield,
|
||||
active: isActive('/admin'),
|
||||
go: () => void navigate('/admin'),
|
||||
@@ -71,28 +81,42 @@ export default function MNavRail() {
|
||||
: []),
|
||||
];
|
||||
|
||||
// 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');
|
||||
const path = location.pathname;
|
||||
const nothingToCreate = path.startsWith('/settings') || path.startsWith('/admin');
|
||||
// /vacay draws its own action (the year/editor switch) into the head, as it
|
||||
// does into the dock's centre on the phone; until it has, the slot stays empty.
|
||||
const screenOwnsHead = path.startsWith('/vacay');
|
||||
const searchFab = path.startsWith('/atlas');
|
||||
|
||||
let head;
|
||||
if (nothingToCreate) {
|
||||
head = (
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="flex h-14 w-14 items-center justify-center rounded-full bg-[color:var(--m-ic)] opacity-70"
|
||||
>
|
||||
<img src="/icons/icon-dark.svg" alt="" className="block h-6 w-6 opacity-75 dark:hidden" />
|
||||
<img src="/icons/icon-white.svg" alt="" className="hidden h-6 w-6 opacity-75 dark:block" />
|
||||
</span>
|
||||
);
|
||||
} else if (screenOwnsHead) {
|
||||
head = screenAction ? <ScreenActionButton /> : <span aria-hidden="true" className="h-14 w-14" />;
|
||||
} else {
|
||||
head = (
|
||||
<MFab onClick={create.run} ariaLabel={create.label} className={FOCUS_RING}>
|
||||
{searchFab ? (
|
||||
<Search size={22} strokeWidth={2.4} />
|
||||
) : create.upload ? (
|
||||
<Upload size={21} strokeWidth={2.4} />
|
||||
) : (
|
||||
<Plus size={24} strokeWidth={2.4} />
|
||||
)}
|
||||
</MFab>
|
||||
);
|
||||
}
|
||||
|
||||
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>
|
||||
)}
|
||||
<MRail label={t('mobileNav.navigation')} fixed head={head}>
|
||||
{main.map((entry) => (
|
||||
<RailEntryButton key={entry.id} {...entry} />
|
||||
))}
|
||||
@@ -105,6 +129,27 @@ export default function MNavRail() {
|
||||
);
|
||||
}
|
||||
|
||||
/** The screen's own action, drawn like the dock's circle: filled, or a ring while it is on. */
|
||||
function ScreenActionButton() {
|
||||
const action = useRailAction();
|
||||
if (!action) return null;
|
||||
const Icon = action.icon;
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={action.run}
|
||||
aria-label={action.label}
|
||||
className={`flex h-14 w-14 flex-none items-center justify-center rounded-full transition-[background,color] duration-300 ease-in-out ${FOCUS_RING} ${
|
||||
action.pressed
|
||||
? '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)]'
|
||||
}`}
|
||||
>
|
||||
<Icon size={24} strokeWidth={2.3} />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
function RailEntryButton({ label, icon: Icon, active, go }: RailEntry) {
|
||||
return (
|
||||
<MRailButton label={label} active={active} onClick={go}>
|
||||
|
||||
@@ -1,24 +1,87 @@
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
import { useFitLabel } from './useFitLabel';
|
||||
import { useLayoutEffect, useRef, type ReactNode, type RefObject } 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.
|
||||
* The 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.
|
||||
*
|
||||
* 80px wide, a navigation rail's width on Android, so a section's name in its
|
||||
* own words has room. Its material is the sheets' near-opaque glass rather than
|
||||
* the dock's: on a map a saturated country used to show through it in bands
|
||||
* behind the names.
|
||||
*
|
||||
* `head` is the action at its top (the "+" and its stand-ins). It stays put
|
||||
* while the entries under it scroll, which they do on a short window.
|
||||
*/
|
||||
export function MRail({ label, fixed = false, children }: { label: string; fixed?: boolean; children: ReactNode }) {
|
||||
export function MRail({
|
||||
label,
|
||||
fixed = false,
|
||||
head,
|
||||
children,
|
||||
}: {
|
||||
label: string;
|
||||
fixed?: boolean;
|
||||
head?: ReactNode;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const listRef = useRef<HTMLDivElement>(null);
|
||||
useEvenLines(listRef);
|
||||
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]`}
|
||||
className={`m-dock-vt ${fixed ? 'fixed' : 'absolute'} bottom-[calc(env(safe-area-inset-bottom,0px)+12px)] start-[calc(var(--m-rail-w)-88px)] top-[var(--m-safe-top,12px)] z-40 flex w-[80px] flex-col items-center rounded-[30px] border border-[color:var(--m-gbr)] bg-[color:var(--m-sheet)] py-3 shadow-[0_16px_44px_-14px_rgba(0,0,0,.35)] backdrop-blur-[30px]`}
|
||||
>
|
||||
{children}
|
||||
{head && <div className="mb-2 flex flex-none justify-center">{head}</div>}
|
||||
<div
|
||||
ref={listRef}
|
||||
className="flex min-h-0 w-full flex-1 flex-col items-center gap-1 overflow-y-auto px-1 [scrollbar-width:none]"
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Every entry of a rail takes the same height: two lines for its name as soon
|
||||
* as one name needs them, one line otherwise. Names wrap where their language
|
||||
* needs, never at a smaller size, and the rail's rhythm does not change from
|
||||
* entry to entry or from language to language.
|
||||
*
|
||||
* What it settles on is written to the list's own style (--m-rail-lines), a
|
||||
* fact about the laid-out names rather than React state. It is measured again
|
||||
* whenever a name changes height (the user's text size, a font arriving).
|
||||
*/
|
||||
function useEvenLines(listRef: RefObject<HTMLDivElement | null>) {
|
||||
useLayoutEffect(() => {
|
||||
const list = listRef.current;
|
||||
if (!list) return;
|
||||
const names = () => Array.from(list.querySelectorAll<HTMLElement>('[data-rail-name]'));
|
||||
const measure = () => {
|
||||
list.style.setProperty('--m-rail-lines', '1');
|
||||
const two = names().some((el) => {
|
||||
const line = parseFloat(getComputedStyle(el).lineHeight) || 0;
|
||||
return line > 0 && el.scrollHeight > line * 1.5;
|
||||
});
|
||||
list.style.setProperty('--m-rail-lines', two ? '2' : '1');
|
||||
};
|
||||
measure();
|
||||
let cancelled = false;
|
||||
void document.fonts?.ready.then(() => {
|
||||
if (!cancelled) measure();
|
||||
});
|
||||
// A name that changes height (the text size setting) is measured again. The
|
||||
// measure itself settles at once, so it cannot keep the observer going.
|
||||
const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure);
|
||||
for (const el of names()) observer?.observe(el);
|
||||
return () => {
|
||||
cancelled = true;
|
||||
observer?.disconnect();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/** Pushes the entries after it to the foot of the rail. */
|
||||
export function MRailSpacer() {
|
||||
return <div className="flex-1" />;
|
||||
@@ -34,9 +97,9 @@ interface MRailButtonProps {
|
||||
|
||||
/**
|
||||
* One destination: the icon on the dock's 40px circle, filled while it is the
|
||||
* current one, its name underneath. The name is never cut: it wraps to two
|
||||
* lines and, where a word is still too long for the rail, shrinks to fit
|
||||
* (useFitLabel), since a touch screen has no hover to tell the rest.
|
||||
* current one, its name underneath at the caption size. The name is never cut
|
||||
* and never shrunk: it wraps into a second, balanced line where its language
|
||||
* needs one, and only a word longer than the rail is hyphenated.
|
||||
*/
|
||||
export function MRailButton({ label, active, onClick, children }: MRailButtonProps) {
|
||||
return (
|
||||
@@ -45,7 +108,7 @@ export function MRailButton({ label, active, onClick, children }: MRailButtonPro
|
||||
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)]"
|
||||
className="group flex w-full flex-none flex-col items-center gap-[3px] rounded-[18px] py-[5px] outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--m-act)]"
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
@@ -55,21 +118,14 @@ export function MRailButton({ label, active, onClick, children }: MRailButtonPro
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
<RailLabel label={label} active={active} />
|
||||
<span
|
||||
data-rail-name=""
|
||||
className={`line-clamp-2 min-h-[calc(1.2em*var(--m-rail-lines,1))] w-full text-center font-geist text-[length:calc(10px*var(--fs-scale-caption,1))] leading-[1.2] [hyphens:auto] [overflow-wrap:anywhere] [text-wrap:balance] ${
|
||||
active ? 'font-bold text-m-ink' : 'font-semibold text-m-muted'
|
||||
}`}
|
||||
>
|
||||
{label}
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
function RailLabel({ label, active }: { label: string; active: boolean }) {
|
||||
const ref = useFitLabel<HTMLSpanElement>(label);
|
||||
return (
|
||||
<span
|
||||
ref={ref}
|
||||
className={`line-clamp-2 w-full text-center font-geist text-[length:calc(10px*var(--fs-scale-caption,1)*var(--fit,1))] leading-[1.2] ${
|
||||
active ? 'font-bold text-m-ink' : 'font-semibold text-m-muted'
|
||||
}`}
|
||||
>
|
||||
{label}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,15 @@ export function MSectionRow({ section, active, current = false, onPick }: MSecti
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The frame of a settings-like screen (settings, administration), one rule for
|
||||
* both: the page column on a phone, a centred column on a wide window, and from
|
||||
* the split size class the list of sections beside a page that runs to the same
|
||||
* width on both screens.
|
||||
*/
|
||||
export const SECTION_SCREEN =
|
||||
'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 split:grid split:max-w-[1240px] split:grid-cols-[260px_minmax(0,1fr)] split:items-start split:gap-8';
|
||||
|
||||
interface MSectionNavProps {
|
||||
title: string;
|
||||
backLabel: string;
|
||||
@@ -40,7 +49,10 @@ interface MSectionNavProps {
|
||||
sections: MSection[];
|
||||
activeId: string;
|
||||
onPick: (id: string) => void;
|
||||
/** An action of the screen, at the end of the list's head (admin: a new user). */
|
||||
/**
|
||||
* An action of the screen (admin: a new user), on a line of its own under the
|
||||
* title, so a long title in a long language keeps the whole width.
|
||||
*/
|
||||
action?: ReactNode;
|
||||
}
|
||||
|
||||
@@ -74,8 +86,8 @@ export default function MSectionNav({
|
||||
<ChevronLeft size={18} strokeWidth={2.2} className="rtl:-scale-x-100" />
|
||||
</button>
|
||||
<span className="min-w-0 flex-1 truncate text-subtitle font-bold text-m-ink">{title}</span>
|
||||
{action}
|
||||
</div>
|
||||
{action && <div className="mb-1 px-[4px]">{action}</div>}
|
||||
{sections.map((section) => (
|
||||
<MSectionRow
|
||||
key={section.id}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import type { LucideIcon } from 'lucide-react';
|
||||
import { useEffect, useLayoutEffect, useRef } from 'react';
|
||||
import { create } from 'zustand';
|
||||
|
||||
/**
|
||||
* A screen's own action at the head of the navigation rail, in the place the
|
||||
* "+" holds elsewhere: the vacation calendar's switch between the year and the
|
||||
* editor. On the phone the same screen draws it into the dock's centre slot.
|
||||
*/
|
||||
export interface RailAction {
|
||||
label: string;
|
||||
icon: LucideIcon;
|
||||
/** On: drawn as a ring rather than filled (the editor is open). */
|
||||
pressed?: boolean;
|
||||
run: () => void;
|
||||
}
|
||||
|
||||
const useRailActionStore = create<{ action: RailAction | null }>(() => ({ action: null }));
|
||||
|
||||
/** The action the screen on show has put at the head of the rail, if any. */
|
||||
export function useRailAction(): RailAction | null {
|
||||
return useRailActionStore((s) => s.action);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the screen's action at the head of the rail while it is mounted; null
|
||||
* takes it away. Pressing it always runs the newest handler, and the rail only
|
||||
* redraws when what it shows changes.
|
||||
*/
|
||||
export function useScreenRailAction(action: RailAction | null): void {
|
||||
const run = useRef(action?.run);
|
||||
useLayoutEffect(() => {
|
||||
run.current = action?.run;
|
||||
});
|
||||
const shown = action !== null;
|
||||
const label = action?.label ?? '';
|
||||
const icon = action?.icon;
|
||||
const pressed = action?.pressed ?? false;
|
||||
useEffect(() => {
|
||||
if (!shown || !icon) return;
|
||||
useRailActionStore.setState({ action: { label, icon, pressed, run: () => run.current?.() } });
|
||||
return () => useRailActionStore.setState({ action: null });
|
||||
}, [shown, label, icon, pressed]);
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
import { useLayoutEffect, useRef } from 'react';
|
||||
|
||||
/** The smallest share of its size a label may shrink to. */
|
||||
const MIN_SCALE = 0.72;
|
||||
const STEP = 0.04;
|
||||
|
||||
/**
|
||||
* Fits a short label into a narrow, fixed box, such as a navigation rail
|
||||
* entry: a name in its own words, on at most two lines, whatever the language.
|
||||
*
|
||||
* The label wraps between words. A word that is still too wide for the box
|
||||
* (German "Einstellungen", Russian "Администрирование") first shrinks the
|
||||
* label, step by step down to MIN_SCALE, the way a tab bar fits its titles; a
|
||||
* name read whole beats one split over two lines. Only a word too long even
|
||||
* then is hyphenated, where the browser knows the language, and past that
|
||||
* broken anywhere. A tap target has no hover, so the whole name has to be on
|
||||
* screen.
|
||||
*
|
||||
* What it settles on is written to the element's own style: `--fit`, which the
|
||||
* element multiplies its font size with, and its hyphenation and wrapping. A
|
||||
* measurement is a fact about the laid-out element, not React state, and
|
||||
* keeping it there spares a second render of every rail entry.
|
||||
*/
|
||||
export function useFitLabel<T extends HTMLElement>(label: string) {
|
||||
const ref = useRef<T>(null);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
const el = ref.current;
|
||||
if (!el) return;
|
||||
let cancelled = false;
|
||||
const fits = () => {
|
||||
const lineHeight = parseFloat(getComputedStyle(el).lineHeight) || 0;
|
||||
const tooWide = el.scrollWidth > el.clientWidth + 0.5;
|
||||
const tooTall = lineHeight > 0 && el.scrollHeight > lineHeight * 2 + 1;
|
||||
return !tooWide && !tooTall;
|
||||
};
|
||||
const shrink = (hyphens: 'manual' | 'auto') => {
|
||||
el.style.hyphens = hyphens;
|
||||
let scale = 1;
|
||||
el.style.setProperty('--fit', '1');
|
||||
while (!fits() && scale - STEP >= MIN_SCALE) {
|
||||
scale = Math.round((scale - STEP) * 100) / 100;
|
||||
el.style.setProperty('--fit', String(scale));
|
||||
}
|
||||
return fits();
|
||||
};
|
||||
const measure = () => {
|
||||
if (cancelled) return;
|
||||
el.style.overflowWrap = 'normal';
|
||||
if (shrink('manual') || shrink('auto')) return;
|
||||
el.style.overflowWrap = 'anywhere';
|
||||
};
|
||||
measure();
|
||||
// The label's font may arrive after the first layout, and it measures differently.
|
||||
void document.fonts?.ready.then(measure);
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [label]);
|
||||
|
||||
return ref;
|
||||
}
|
||||
@@ -46,7 +46,7 @@ import MAdminUsersSection from './MAdminUsersSection'
|
||||
import { MAdminButton } from './MAdminUi'
|
||||
import { managedAdminTabs } from '../../../managed'
|
||||
import { useIsSplit } from '../../../hooks/sizeClass'
|
||||
import MSectionNav, { MSectionRow, type MSection } from '../../components/MSectionNav'
|
||||
import MSectionNav, { MSectionRow, SECTION_SCREEN, type MSection } from '../../components/MSectionNav'
|
||||
|
||||
// Stat card of the 2×2 grid (design §6.3): 34px icon tile, 19px/800 number,
|
||||
// small tracking label. Count-up animation matches the desktop stat cards.
|
||||
@@ -57,9 +57,9 @@ function MAdminStat({ label, value, icon: Icon }: { label: string; value: number
|
||||
<span className="flex h-[34px] w-[34px] flex-none items-center justify-center rounded-[11px] bg-[color:var(--m-ic)] text-m-ink">
|
||||
<Icon size={16} strokeWidth={2} />
|
||||
</span>
|
||||
<div>
|
||||
<div className="min-w-0">
|
||||
<div className="text-[1.1875rem] font-extrabold leading-none text-m-ink">{animated}</div>
|
||||
<div className="mt-[2px] font-geist text-[0.59375rem] font-bold tracking-[0.06em] text-m-faint">{label}</div>
|
||||
<div className="mt-[2px] truncate font-geist text-[0.59375rem] font-bold tracking-[0.06em] text-m-faint" title={label}>{label}</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -112,7 +112,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)] wide:mx-auto wide:max-w-[1040px] wide:px-6 split:grid split:max-w-[1240px] split:grid-cols-[260px_minmax(0,1fr)] split:items-start split:gap-8">
|
||||
<div className={SECTION_SCREEN}>
|
||||
{split && (
|
||||
<MSectionNav
|
||||
title={t('admin.title')}
|
||||
@@ -124,11 +124,11 @@ export default function MAdmin() {
|
||||
action={
|
||||
<button
|
||||
type="button"
|
||||
aria-label={t('admin.createUser')}
|
||||
onClick={() => setShowCreateUser(true)}
|
||||
className="flex h-[34px] w-[34px] flex-none items-center justify-center rounded-full bg-m-act text-m-actfg outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--m-act)] focus-visible:ring-offset-2"
|
||||
className="flex h-[34px] w-full items-center justify-center gap-[7px] rounded-full bg-m-act px-3 text-[length:calc(12px*var(--fs-scale-body,1))] font-bold text-m-actfg outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--m-act)] focus-visible:ring-offset-2"
|
||||
>
|
||||
<UserPlus size={15} strokeWidth={2.2} />
|
||||
<UserPlus size={14} strokeWidth={2.2} className="flex-none" />
|
||||
<span className="truncate">{t('admin.createUser')}</span>
|
||||
</button>
|
||||
}
|
||||
/>
|
||||
@@ -143,7 +143,7 @@ export default function MAdmin() {
|
||||
onClick={() => navigate('/dashboard')}
|
||||
className="flex h-[38px] w-[38px] flex-none items-center justify-center rounded-full border border-[color:var(--m-gbr)] bg-[color:var(--m-sheet)] text-m-ink shadow-[0_5px_12px_-8px_rgba(0,0,0,.18)]"
|
||||
>
|
||||
<ChevronLeft size={18} strokeWidth={2.2} />
|
||||
<ChevronLeft size={18} strokeWidth={2.2} className="rtl:-scale-x-100" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -36,10 +36,14 @@ export default function MAdminUsersSection({ admin, t, locale }: MAdminUsersSect
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<MAdminCard>
|
||||
<div className="mb-1 flex items-center gap-2">
|
||||
<span className="text-[0.875rem] font-extrabold text-m-ink">{t('admin.tabs.users')}</span>
|
||||
<span className="font-geist text-[0.625rem] font-bold text-m-faint">
|
||||
{users.length} {t('admin.stats.users', { count: users.length })}
|
||||
{/* Wraps rather than overflows: in a long language the button moves under
|
||||
the title and its count, inside the card, instead of past its edge. */}
|
||||
<div className="mb-1 flex flex-wrap items-center gap-x-2 gap-y-2">
|
||||
<span className="flex min-w-0 items-baseline gap-2">
|
||||
<span className="text-[0.875rem] font-extrabold text-m-ink">{t('admin.tabs.users')}</span>
|
||||
<span className="whitespace-nowrap font-geist text-[0.625rem] font-bold text-m-faint">
|
||||
{users.length} {t('admin.stats.users', { count: users.length })}
|
||||
</span>
|
||||
</span>
|
||||
<MAdminButton className="ms-auto" onClick={() => setShowCreateUser(true)}>
|
||||
<UserPlus size={12} strokeWidth={2.2} />
|
||||
@@ -77,9 +81,11 @@ export default function MAdminUsersSection({ admin, t, locale }: MAdminUsersSect
|
||||
</span>
|
||||
<span
|
||||
className={`flex-none whitespace-nowrap rounded-full px-[9px] py-[3px] font-geist text-[0.5625rem] font-extrabold ${
|
||||
// Dark mode lifts the words towards the ink: the plain status red on a
|
||||
// dark red ground and grey on grey were both below 4.5:1 there.
|
||||
u.role === 'admin'
|
||||
? 'bg-[color:color-mix(in_srgb,var(--m-st-danger)_12%,transparent)] text-[color:var(--m-st-danger)]'
|
||||
: 'bg-[color:var(--m-ic)] text-m-muted'
|
||||
? 'bg-[color:color-mix(in_srgb,var(--m-st-danger)_12%,transparent)] text-[color:var(--m-st-danger)] dark:bg-[color:color-mix(in_srgb,var(--m-st-danger)_18%,transparent)] dark:text-[color:color-mix(in_srgb,var(--m-st-danger)_55%,var(--m-ink))]'
|
||||
: 'bg-[color:var(--m-ic)] text-m-muted dark:text-m-ink'
|
||||
}`}
|
||||
>
|
||||
{u.role === 'admin' ? t('settings.roleAdmin') : t('settings.roleUser')}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useSearchParams } from 'react-router'
|
||||
import { CalendarClock, X } from 'lucide-react'
|
||||
import { useAtlas } from '../../../pages/atlas/useAtlas'
|
||||
@@ -28,7 +28,21 @@ const removeBtnCls = 'mt-4 w-full rounded-full bg-[rgba(214,39,59,.12)] py-[11px
|
||||
* useAtlas hook — this file is presentation and wiring only.
|
||||
*/
|
||||
export default function MAtlas() {
|
||||
const atlas = useAtlas()
|
||||
const rootRef = useRef<HTMLDivElement>(null)
|
||||
const headerRef = useRef<HTMLDivElement>(null)
|
||||
// The map runs under the rail (m-bleed) and the header: the camera keeps clear
|
||||
// of both. The rail's share is the root's own negative margin, resolved by the
|
||||
// browser; the header's is how far down it reaches.
|
||||
const atlas = useAtlas({
|
||||
chromeInsets: () => {
|
||||
const root = rootRef.current
|
||||
if (!root) return { top: 0, start: 0 }
|
||||
const start = Math.max(0, -parseFloat(getComputedStyle(root).marginInlineStart) || 0)
|
||||
const header = headerRef.current?.getBoundingClientRect()
|
||||
const top = header ? Math.max(0, header.bottom - root.getBoundingClientRect().top) : 0
|
||||
return { top, start }
|
||||
},
|
||||
})
|
||||
const {
|
||||
t,
|
||||
navigate,
|
||||
@@ -109,7 +123,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="m-bleed relative h-dvh overflow-hidden">
|
||||
<div ref={rootRef} 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 +134,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="m-bar-x absolute top-[var(--m-safe-top,12px)] z-[5] flex items-center gap-2 wide:mx-auto wide:max-w-[720px]">
|
||||
<div ref={headerRef} 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)}
|
||||
|
||||
@@ -16,9 +16,12 @@ interface MCollPlaceRowProps {
|
||||
}
|
||||
|
||||
/**
|
||||
* A saved place: the main card (tinted category tile, name, address) next to
|
||||
* the status column with the status pill (tap = cycle Idea → Want to go →
|
||||
* Visited) and the category pill. In select mode a tap toggles the selection.
|
||||
* A saved place, one card: the tinted category tile, name and address, and at
|
||||
* its trailing end the status pill (tap = cycle Idea → Want to go → Visited)
|
||||
* over the category pill. In select mode a tap toggles the selection.
|
||||
*
|
||||
* The pills used to stand in a card of their own beside the place, mostly empty
|
||||
* and a third of a narrow window wide, which cut the names short.
|
||||
*/
|
||||
export default function MCollPlaceRow({
|
||||
place, selectMode, selected, canEdit, onOpen, onToggleSelect, onSetStatus, t,
|
||||
@@ -30,16 +33,24 @@ export default function MCollPlaceRow({
|
||||
const StatusIcon = status.icon
|
||||
|
||||
const pill =
|
||||
'inline-flex w-[78px] box-border items-center justify-center gap-1 truncate rounded-full py-[5px] font-geist text-[0.5625rem] font-extrabold'
|
||||
'inline-flex max-w-[92px] box-border items-center justify-center gap-1 rounded-full px-2 py-[4px] font-geist text-[0.5625rem] font-extrabold'
|
||||
// The words in the colour, pulled towards the ink so they read on the light
|
||||
// ground as well as on the dark one; the ground a stronger wash of it.
|
||||
const pillStyle = (color: string) => ({
|
||||
background: `color-mix(in srgb, ${color} 16%, transparent)`,
|
||||
color: `color-mix(in srgb, ${color} 62%, var(--m-ink))`,
|
||||
})
|
||||
|
||||
return (
|
||||
<div className="mt-2 flex items-stretch gap-2">
|
||||
<div
|
||||
className="mt-2 flex items-center rounded-2xl border border-[color:var(--m-rowbr)] bg-m-sheetop"
|
||||
style={selected ? { boxShadow: 'inset 0 0 0 1.5px var(--m-act)' } : undefined}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => (selectMode ? onToggleSelect(place.id) : onOpen(place.id))}
|
||||
aria-pressed={selectMode ? selected : undefined}
|
||||
className="flex min-w-0 flex-1 items-center gap-[11px] rounded-2xl border border-[color:var(--m-rowbr)] bg-m-sheetop px-3 py-[11px] text-start"
|
||||
style={selected ? { boxShadow: 'inset 0 0 0 1.5px var(--m-act)' } : undefined}
|
||||
className="flex min-w-0 flex-1 items-center gap-[11px] self-stretch rounded-2xl py-[11px] pe-2 ps-3 text-start"
|
||||
>
|
||||
<span
|
||||
className={`flex h-10 w-10 flex-none items-center justify-center rounded-xl ${selected ? 'bg-m-act text-m-actfg' : ''}`}
|
||||
@@ -58,20 +69,20 @@ export default function MCollPlaceRow({
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<div className="flex flex-none flex-col justify-center gap-[5px] rounded-2xl border border-[color:var(--m-rowbr)] bg-m-sheetop px-[10px] py-2">
|
||||
<div className="flex flex-none flex-col items-end justify-center gap-[5px] py-2 pe-3">
|
||||
<button
|
||||
type="button"
|
||||
disabled={!canEdit || selectMode}
|
||||
onClick={() => onSetStatus(place.id, nextStatus(place.status))}
|
||||
aria-label={t(status.labelKey)}
|
||||
className={pill}
|
||||
style={{ background: tint(status.color, '18'), color: status.color }}
|
||||
style={pillStyle(status.color)}
|
||||
>
|
||||
<StatusIcon size={9} strokeWidth={2.6} className="flex-none" />
|
||||
<span className="truncate">{t(status.labelKey)}</span>
|
||||
</button>
|
||||
{cat && place.category?.name && (
|
||||
<span className={pill} style={{ background: tint(cat.color, '18'), color: cat.color }}>
|
||||
<span className={pill} style={pillStyle(cat.color)}>
|
||||
<TileIcon size={9} strokeWidth={2.6} className="flex-none" />
|
||||
<span className="truncate">{place.category.name}</span>
|
||||
</span>
|
||||
|
||||
@@ -29,6 +29,7 @@ import type { MobileDashToken } from '@trek/shared'
|
||||
import { usePullToRefresh } from '../../usePullToRefresh'
|
||||
import MPullIndicator from '../../components/MPullIndicator'
|
||||
import SharedConfirmSheet from '../settings/MConfirmSheet'
|
||||
import { edgeFadeClass, useEdgeFade } from '../../components/useEdgeFade'
|
||||
|
||||
type TripFilter = 'planned' | 'archive' | 'completed'
|
||||
|
||||
@@ -62,6 +63,10 @@ export default function MDashboard(): React.ReactElement {
|
||||
const split = useIsSplit()
|
||||
const { available: assistantAvailable, open: openAssistant } = useAssistantHomeLauncher()
|
||||
const [subOpen, setSubOpen] = useState(false)
|
||||
// The filter chips scroll when a language's words do not fit beside the two
|
||||
// buttons, and fade out where more of them waits.
|
||||
const [filterStrip, setFilterStrip] = useState<HTMLDivElement | null>(null)
|
||||
const filterFade = useEdgeFade(filterStrip)
|
||||
|
||||
// Plugin dashboard widgets + trip-card badges, mirroring the desktop page:
|
||||
// same slot filter (only true dashboard widgets), one badge fetch for all
|
||||
@@ -134,7 +139,7 @@ export default function MDashboard(): React.ReactElement {
|
||||
forced zoom. min-w-max keeps the pill track wrapping its chips,
|
||||
and the box stays content-wide (no flex-1) so the pill still hugs
|
||||
them on wide phones while ms-auto parks the icons at the end. */}
|
||||
<div className="m-hscroll min-w-0">
|
||||
<div ref={setFilterStrip} className={`m-hscroll min-w-0 ${edgeFadeClass(filterFade)}`}>
|
||||
<MSegmented<TripFilter>
|
||||
value={tripFilter}
|
||||
onChange={setTripFilter}
|
||||
@@ -216,7 +221,8 @@ export default function MDashboard(): React.ReactElement {
|
||||
|
||||
return (
|
||||
<>
|
||||
<MGlassBar floating>
|
||||
{/* In the column the cards below stand in, so their edges line up. */}
|
||||
<MGlassBar column="wide:max-w-[1280px]">
|
||||
<button
|
||||
type="button"
|
||||
// The page itself is the scroller since #1809, no inner container to walk up to.
|
||||
@@ -391,7 +397,9 @@ 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)] outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--m-act)] wide:h-[clamp(300px,42vh,440px)]"
|
||||
// A phone on its side has no 300px to spare between the top bar and the dock:
|
||||
// the card ends above the dock rather than under it.
|
||||
className="relative h-[clamp(200px,calc(100svh-var(--m-safe-top,12px)-82px-var(--bottom-nav-h,84px)-14px),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" />
|
||||
@@ -416,7 +424,7 @@ function MSpotlightCard({ trip, t, onOpen, actions }: {
|
||||
<span className="absolute bottom-0 left-0 top-0 rounded-full bg-white" style={{ width: `${progress}%` }} />
|
||||
</div>
|
||||
)}
|
||||
<div className={`flex gap-[6px] ${ongoing ? '' : 'mt-[9px]'}`}>
|
||||
<div className={`flex flex-wrap gap-[6px] ${ongoing ? '' : 'mt-[9px]'}`}>
|
||||
<SpotlightPill icon={<CalendarDays size={11} strokeWidth={2.2} />} label={t('dashboard.mobile.spotlightDays', { count: days })} />
|
||||
<SpotlightPill icon={<MapPin size={11} strokeWidth={2.2} />} label={t('dashboard.hero.destinations', { count: places })} />
|
||||
<SpotlightPill icon={<Users size={11} strokeWidth={2.2} />} label={t('dashboard.hero.travelers', { count: people })} />
|
||||
@@ -439,7 +447,8 @@ function MSpotlightCard({ trip, t, onOpen, actions }: {
|
||||
*/
|
||||
function SpotlightPill({ icon, label }: { icon: React.ReactElement; label: string }): React.ReactElement {
|
||||
return (
|
||||
<span className="inline-flex items-center gap-1 rounded-full bg-white/[.28] px-[9px] py-[3px] font-geist text-[0.5625rem] font-bold tracking-[.07em] text-white uppercase">
|
||||
// One line per chip: a narrow card wraps whole chips rather than breaking the number from its word.
|
||||
<span className="inline-flex items-center gap-1 whitespace-nowrap rounded-full bg-white/[.28] px-[9px] py-[3px] font-geist text-[0.5625rem] font-bold tracking-[.07em] text-white uppercase">
|
||||
{icon}
|
||||
{label}
|
||||
</span>
|
||||
@@ -453,7 +462,9 @@ function CoverActionBtn({ action }: { action: CardAction }): React.ReactElement
|
||||
type="button"
|
||||
aria-label={action.label}
|
||||
onClick={e => { e.stopPropagation(); action.onClick() }}
|
||||
className="flex h-[34px] w-[34px] items-center justify-center rounded-full border border-white/30 bg-white/[.22] text-white backdrop-blur-[8px]"
|
||||
// A dark ground, not a white veil: over a bright sky the veil and its white
|
||||
// icon disappeared together.
|
||||
className="flex h-[34px] w-[34px] items-center justify-center rounded-full border border-white/25 bg-[color:var(--overlay)] text-white backdrop-blur-[8px]"
|
||||
>
|
||||
{action.icon}
|
||||
</button>
|
||||
@@ -529,14 +540,13 @@ function MTripGridCard({ trip, locale, badge, pluginBadges, actions, onOpen }: {
|
||||
</div>
|
||||
</div>
|
||||
<div className="p-[9px_12px_12px]">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="min-w-0 flex-1 truncate text-[0.875rem] font-semibold">{trip.title}</div>
|
||||
<span className="inline-flex flex-none items-center gap-[6px] rounded-full bg-[color:var(--m-ic)] px-[10px] py-1 font-geist text-[0.6875rem] font-semibold text-m-ink">
|
||||
<span>{fullDate(trip.start_date, locale) ?? '—'}</span>
|
||||
<ArrowRight size={12} strokeWidth={2.2} className="text-m-faint" />
|
||||
<span>{fullDate(trip.end_date, locale) ?? '—'}</span>
|
||||
</span>
|
||||
</div>
|
||||
{/* The name has the card's whole width; the dates take the line under it. */}
|
||||
<div className="truncate text-[0.875rem] font-semibold">{trip.title}</div>
|
||||
<span className="mt-[6px] inline-flex max-w-full items-center gap-[6px] rounded-full bg-[color:var(--m-ic)] px-[10px] py-1 font-geist text-[0.6875rem] font-semibold text-m-ink">
|
||||
<span className="truncate">{fullDate(trip.start_date, locale) ?? '—'}</span>
|
||||
<ArrowRight size={12} strokeWidth={2.2} className="flex-none text-m-faint" />
|
||||
<span className="truncate">{fullDate(trip.end_date, locale) ?? '—'}</span>
|
||||
</span>
|
||||
<MTripBadges items={pluginBadges} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,8 @@ import MDancingTrek from '../../components/MDancingTrek'
|
||||
import { journeyCoverSrc, journeyCoverStyle } from './mobileJourneyMeta'
|
||||
import { usePullToRefresh } from '../../usePullToRefresh'
|
||||
import MPullIndicator from '../../components/MPullIndicator'
|
||||
import MGlassBar from '../../components/MGlassBar'
|
||||
import { useIsWide } from '../../../hooks/sizeClass'
|
||||
|
||||
type JourneyListItem = Journey & {
|
||||
entry_count?: number
|
||||
@@ -25,6 +27,7 @@ export default function MJourney() {
|
||||
openCreateModal, handleCreate, activeJourney,
|
||||
} = useJourney()
|
||||
const scrollRef = useRef<HTMLDivElement>(null)
|
||||
const wide = useIsWide()
|
||||
const pull = usePullToRefresh(scrollRef, loadJourneys, true, scrollRef)
|
||||
|
||||
const list = journeys as JourneyListItem[]
|
||||
@@ -36,22 +39,22 @@ export default function MJourney() {
|
||||
// The feed below keeps its own scroller, so this screen does not move the
|
||||
// document and Safari's address bar stays put here.
|
||||
<div className="relative h-dvh">
|
||||
{/* Floating header: back + create pill. On a wide window it keeps to the
|
||||
column of cards and names the page at its start, as an iPad title bar does. */}
|
||||
<div className="m-bar-x fixed top-[var(--m-safe-top,12px)] z-30 flex items-center gap-[10px] wide:mx-auto wide:max-w-[1040px]">
|
||||
<h1 className="hidden min-w-0 flex-1 truncate text-title font-extrabold text-m-ink wide:block">{t('journey.title')}</h1>
|
||||
<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 wide:ms-auto wide:flex-none wide:px-5"
|
||||
>
|
||||
<Plus size={14} strokeWidth={2.4} />
|
||||
{t('journey.frontpage.createJourney')}
|
||||
</button>
|
||||
</div>
|
||||
{/* Floating header: the create pill. On a wide window it is the glass bar
|
||||
the dashboard and the notifications have, in the column of cards below
|
||||
it, and names the page at its start, as an iPad title bar does. */}
|
||||
{wide ? (
|
||||
<MGlassBar column="wide:max-w-[1088px]">
|
||||
<h1 className="min-w-0 flex-1 truncate ps-1 text-subtitle font-extrabold text-m-ink">{t('journey.title')}</h1>
|
||||
<CreateButton label={t('journey.frontpage.createJourney')} onClick={() => openCreateModal()} />
|
||||
</MGlassBar>
|
||||
) : (
|
||||
<div className="m-bar-x fixed top-[var(--m-safe-top,12px)] z-30 flex items-center gap-[10px]">
|
||||
<CreateButton label={t('journey.frontpage.createJourney')} onClick={() => openCreateModal()} grow />
|
||||
</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)] wide:px-6 wide:[&>*]:mx-auto wide:[&>*]:max-w-[1040px]">
|
||||
<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:pt-[calc(var(--m-safe-top,12px)+72px)] 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" />
|
||||
@@ -67,8 +70,10 @@ export default function MJourney() {
|
||||
|
||||
{rest.length > 0 && (
|
||||
<>
|
||||
{/* On a wide window it stands at the start, over the cards it
|
||||
introduces, like every section label; the phone centres it. */}
|
||||
<div className="mx-[2px] mb-3 mt-[2px] flex items-center gap-[10px]">
|
||||
<span className="h-px flex-1 bg-[color:var(--m-rowbr)]" />
|
||||
<span className="h-px flex-1 bg-[color:var(--m-rowbr)] wide:hidden" />
|
||||
<span className="font-geist text-[0.625rem] font-bold uppercase tracking-[.09em] text-m-faint">
|
||||
{t('mobileJourney.otherJourneys')}
|
||||
</span>
|
||||
@@ -106,6 +111,21 @@ export default function MJourney() {
|
||||
)
|
||||
}
|
||||
|
||||
function CreateButton({ label, onClick, grow = false }: { label: string; onClick: () => void; grow?: boolean }) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
className={`flex h-[38px] items-center justify-center gap-[6px] whitespace-nowrap rounded-full bg-m-act text-[0.78125rem] font-bold text-m-actfg ${
|
||||
grow ? 'flex-1 px-[15px]' : 'flex-none px-5'
|
||||
}`}
|
||||
>
|
||||
<Plus size={14} strokeWidth={2.4} />
|
||||
{label}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
function HeroCard({ journey, onOpen }: { journey: JourneyListItem; onOpen: () => void }) {
|
||||
const { t } = useTranslation()
|
||||
const src = journeyCoverSrc(journey.cover_image)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react'
|
||||
import { useSearchParams } from 'react-router'
|
||||
import { ChevronLeft, MapPin, Grid3x3, MoreHorizontal, Play, Image, Camera, EyeOff, Settings2, X, Route, ListChecks } from 'lucide-react'
|
||||
import JourneyLayeredMap from '../../../components/Journey/JourneyLayeredMap'
|
||||
@@ -42,12 +42,31 @@ import MJourneyRecordingSheet from './MJourneyRecordingSheet'
|
||||
* (`embedded`): the trip's back button and controls sit on top, so the screen
|
||||
* drops its own back button and leaves the trip's URL alone.
|
||||
*/
|
||||
/** A phone on its side: too short for the regular strip of cards and the map above it. */
|
||||
const SHORT_WINDOW = '(max-height: 500px)'
|
||||
function subscribeShort(onChange: () => void) {
|
||||
const mq = window.matchMedia(SHORT_WINDOW)
|
||||
mq.addEventListener('change', onChange)
|
||||
return () => mq.removeEventListener('change', onChange)
|
||||
}
|
||||
const readShort = () => window.matchMedia(SHORT_WINDOW).matches
|
||||
|
||||
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()
|
||||
// With room for two panes the entries stand as a feed beside the map (MJourneyFeed)
|
||||
// instead of the strip of cards over it.
|
||||
const split = useIsSplit()
|
||||
// On a short window the cards are smaller and the map is framed above them.
|
||||
const short = useSyncExternalStore(subscribeShort, readShort, () => false)
|
||||
// The map runs under the rail (m-bleed); framing keeps the journey clear of it.
|
||||
// The rail's share is the root's own negative margin, as the browser resolves it.
|
||||
const rootRef = useRef<HTMLDivElement>(null)
|
||||
const [railInset, setRailInset] = useState(0)
|
||||
useLayoutEffect(() => {
|
||||
const root = rootRef.current
|
||||
if (root) setRailInset(Math.max(0, -parseFloat(getComputedStyle(root).marginInlineStart) || 0))
|
||||
}, [wide])
|
||||
const {
|
||||
id, navigate, toast, t, locale,
|
||||
current, loading,
|
||||
@@ -315,7 +334,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="m-bleed relative h-dvh overflow-hidden">
|
||||
<div ref={rootRef} className="m-bleed relative h-dvh overflow-hidden">
|
||||
{/* Integrated map — always mounted, the gallery overlays it. Beside the feed
|
||||
it begins where the feed ends, so its controls and its framing stay in
|
||||
the part that can be seen. */}
|
||||
@@ -341,7 +360,8 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD
|
||||
onMarkerClick={handleMarkerClick}
|
||||
onMarkerCardClick={openEntryById}
|
||||
fullScreen
|
||||
paddingBottom={250}
|
||||
paddingBottom={short ? 280 : 250}
|
||||
paddingStart={feed ? 0 : railInset}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -434,7 +454,7 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD
|
||||
aria-label={t('journey.detail.backToJourney')}
|
||||
className="flex h-[38px] w-[38px] flex-none items-center justify-center rounded-full bg-[color:var(--m-sheet)] text-m-ink shadow-[0_5px_14px_-6px_rgba(0,0,0,.3)]"
|
||||
>
|
||||
<ChevronLeft size={18} strokeWidth={2.2} />
|
||||
<ChevronLeft size={18} strokeWidth={2.2} className="rtl:-scale-x-100" />
|
||||
</button>
|
||||
)}
|
||||
<div className="absolute left-1/2 top-0 flex -translate-x-1/2 rounded-full bg-[color:var(--m-sheet)] p-[3px] shadow-[0_5px_14px_-6px_rgba(0,0,0,.3)]">
|
||||
@@ -541,14 +561,18 @@ export default function MJourneyDetail({ journeyId, embedded = false }: JourneyD
|
||||
gives the strip the rest. */}
|
||||
{view === 'timeline' && entries.length > 0 && !feed && (
|
||||
<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}
|
||||
onPick={jumpToDay}
|
||||
/>
|
||||
{/* The days and the date on a plate of their own, so the map's names do
|
||||
not run through them. */}
|
||||
<div className="mx-3 rounded-[18px] border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] pt-[6px] backdrop-blur-[18px] backdrop-saturate-[1.4] empty:hidden">
|
||||
<JourneyDayScrubber
|
||||
days={scrubberDays}
|
||||
activeDate={entries[activeIndex]?.entry_date ?? null}
|
||||
onPick={jumpToDay}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
ref={carouselRef}
|
||||
className="flex items-end gap-[22px] overflow-x-auto px-6 pb-1 pt-[30px] [-webkit-overflow-scrolling:touch] [scrollbar-width:none]"
|
||||
className={`flex items-end gap-[22px] overflow-x-auto px-6 pb-1 ${short ? 'pt-[22px]' : 'pt-[30px]'} [-webkit-overflow-scrolling:touch] [scrollbar-width:none]`}
|
||||
style={{ scrollSnapType: 'x mandatory' }}
|
||||
>
|
||||
{entries.map((entry, i) => (
|
||||
@@ -565,7 +589,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'}
|
||||
size={wide ? 'large' : short ? 'compact' : 'regular'}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useRef } from 'react'
|
||||
import { useNavigate } from 'react-router'
|
||||
import { ArrowLeft, CheckCheck, Trash2 } from 'lucide-react'
|
||||
import { CheckCheck, ChevronLeft, Trash2 } from 'lucide-react'
|
||||
import MDancingTrek from '../../components/MDancingTrek'
|
||||
import ConfirmDialog from '../../../components/shared/ConfirmDialog'
|
||||
import { useTranslation } from '../../../i18n'
|
||||
@@ -40,10 +40,11 @@ export default function MNotifications() {
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* On a wide window the bar keeps to the column of the list below it. */}
|
||||
<MGlassBar className="wide:mx-auto wide:max-w-[760px]">
|
||||
{/* On a wide window the bar keeps to the column of the list below it. The
|
||||
way back is the round chevron every other screen has. */}
|
||||
<MGlassBar column="wide:max-w-[808px]">
|
||||
<MIconBtn ariaLabel={t('common.back')} onClick={() => navigate(-1)}>
|
||||
<ArrowLeft size={18} strokeWidth={2} />
|
||||
<ChevronLeft size={18} strokeWidth={2.2} className="rtl:-scale-x-100" />
|
||||
</MIconBtn>
|
||||
<div className="flex min-w-0 flex-1 items-center gap-2">
|
||||
{/* Two lines, hyphenated, before an ellipsis: "Benachrichtigungen" was
|
||||
|
||||
@@ -27,7 +27,7 @@ import MSettingsAccount from './MSettingsAccount'
|
||||
import MSettingsAbout from './MSettingsAbout'
|
||||
import MSettingsServer from './MSettingsServer'
|
||||
import { useIsSplit } from '../../../hooks/sizeClass'
|
||||
import MSectionNav, { MSectionRow, type MSection } from '../../components/MSectionNav'
|
||||
import MSectionNav, { MSectionRow, SECTION_SCREEN, type MSection } from '../../components/MSectionNav'
|
||||
|
||||
/**
|
||||
* Mobile settings screen: back + section-switcher pill on top, the section
|
||||
@@ -64,7 +64,9 @@ export default function MSettings() {
|
||||
const active = tabs.find((tab) => tab.id === activeTab) || tabs[0]
|
||||
|
||||
return (
|
||||
<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">
|
||||
// The same frame as administration's: beside the sections the page runs to
|
||||
// the same width there and here.
|
||||
<div className={SECTION_SCREEN}>
|
||||
{split && (
|
||||
<MSectionNav
|
||||
title={t('settings.title')}
|
||||
@@ -75,7 +77,7 @@ export default function MSettings() {
|
||||
onPick={setActiveTab}
|
||||
/>
|
||||
)}
|
||||
<div className="min-w-0 wide:mx-auto wide:w-full wide:max-w-[720px] split:mx-0">
|
||||
<div className="min-w-0">
|
||||
{/* Header: back + section switcher pill */}
|
||||
{!split && (
|
||||
<div className="mb-3 flex items-center gap-2">
|
||||
@@ -85,7 +87,7 @@ export default function MSettings() {
|
||||
onClick={() => navigate('/dashboard')}
|
||||
className="flex h-[38px] w-[38px] flex-none items-center justify-center rounded-full border border-[color:var(--m-gbr)] bg-[color:var(--m-sheet)] text-m-ink shadow-[0_5px_12px_-8px_rgba(0,0,0,.18)]"
|
||||
>
|
||||
<ChevronLeft size={18} strokeWidth={2.2} />
|
||||
<ChevronLeft size={18} strokeWidth={2.2} className="rtl:-scale-x-100" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -15,6 +15,8 @@ import MVacayShareSheet from './MVacayShareSheet'
|
||||
import { FALLBACK_PERSON_COLOR } from './vacayDayModel'
|
||||
import { fmtDays } from '../../../components/Vacay/vacayFormat'
|
||||
import { TileHeader } from '../trip/sheets/MTripSheetUi'
|
||||
import { useIsWide } from '../../../hooks/sizeClass'
|
||||
import { useScreenRailAction } from '../../components/railAction'
|
||||
|
||||
/** The company-holiday tint the calendar cells use (vacayDayModel). */
|
||||
const COMPANY_COLOR = 'var(--m-vacay-company)'
|
||||
@@ -24,6 +26,18 @@ const SHEET_ROW = 'flex items-center gap-3 rounded-[16px] border border-[color:v
|
||||
const WEEKDAY_KEYS_MONDAY = ['vacay.mon', 'vacay.tue', 'vacay.wed', 'vacay.thu', 'vacay.fri', 'vacay.sat', 'vacay.sun'] as const
|
||||
const WEEKDAY_KEYS_SUNDAY = ['vacay.sun', 'vacay.mon', 'vacay.tue', 'vacay.wed', 'vacay.thu', 'vacay.fri', 'vacay.sat'] as const
|
||||
|
||||
/**
|
||||
* The seven columns of a month in the year grid, as single letters in the
|
||||
* reader's language (M T W T F S S, П В С Ч П С В), from the week's first day.
|
||||
* Narrow forms, because a column of the year grid is a few points wide and the
|
||||
* edit view's day names (Arabic spells them out) do not fit there.
|
||||
*/
|
||||
function narrowWeekdays(locale: string, weekStart: number): string[] {
|
||||
const format = new Intl.DateTimeFormat(locale, { weekday: 'narrow' })
|
||||
// 2023-01-01 was a Sunday: day 0 of the week.
|
||||
return Array.from({ length: 7 }, (_, i) => format.format(new Date(2023, 0, 1 + ((weekStart + i) % 7))))
|
||||
}
|
||||
|
||||
/**
|
||||
* Mobile Vacay screen: year pill header, person card with inline entitlement
|
||||
* stepper, member/legend chips and the 12-month grid — or, in edit mode, the
|
||||
@@ -32,8 +46,24 @@ const WEEKDAY_KEYS_SUNDAY = ['vacay.sun', 'vacay.mon', 'vacay.tue', 'vacay.wed',
|
||||
* the editor logs; the screen's own FAB in the dock centre flips back.
|
||||
*/
|
||||
export default function MVacay() {
|
||||
const { t } = useTranslation()
|
||||
const { t, locale } = useTranslation()
|
||||
const v = useMVacay()
|
||||
const wide = useIsWide()
|
||||
const edit = v.view === 'edit'
|
||||
|
||||
// On a wide window there is no dock to hold the year/editor switch, and a
|
||||
// circle floating over the calendar hid the days under it: it goes to the head
|
||||
// of the rail instead, where the "+" stands on the other screens.
|
||||
useScreenRailAction(
|
||||
wide && !v.loading
|
||||
? {
|
||||
label: edit ? t('mobileVacay.viewYear') : t('mobileVacay.editCalendar'),
|
||||
icon: edit ? Eye : PenLine,
|
||||
pressed: edit,
|
||||
run: v.toggleView,
|
||||
}
|
||||
: null
|
||||
)
|
||||
|
||||
if (v.loading) {
|
||||
return (
|
||||
@@ -43,13 +73,13 @@ export default function MVacay() {
|
||||
)
|
||||
}
|
||||
|
||||
const edit = v.view === 'edit'
|
||||
const stat = v.selectedStat
|
||||
const pct = stat && stat.total_available > 0 ? Math.round((stat.used / stat.total_available) * 100) : 0
|
||||
const leftColor = stat && stat.remaining <= 0
|
||||
? (stat.remaining < 0 ? 'var(--m-st-danger)' : 'var(--m-st-pending)')
|
||||
: v.selectedColor
|
||||
const weekdayKeys = v.weekStart === 0 ? WEEKDAY_KEYS_SUNDAY : WEEKDAY_KEYS_MONDAY
|
||||
const weekdayLetters = narrowWeekdays(locale, v.weekStart)
|
||||
// People to pick between: fused members, or shared calendars to show or hide.
|
||||
const peopleChoosable = v.users.length > 1 || v.incomingShares.length > 0
|
||||
const legendItems = [
|
||||
@@ -85,7 +115,7 @@ export default function MVacay() {
|
||||
</div>
|
||||
|
||||
{/* Scroll container */}
|
||||
<div className="absolute inset-0 overflow-y-auto px-4 pt-[calc(var(--m-safe-top,12px)+44px)] pb-[calc(var(--bottom-nav-h,84px)+12px)]">
|
||||
<div className={`absolute inset-0 overflow-y-auto px-4 pt-[calc(var(--m-safe-top,12px)+44px)] pb-[calc(var(--bottom-nav-h,84px)+12px)] ${edit ? 'wide:pb-[calc(env(safe-area-inset-bottom,0px)+84px)]' : ''}`}>
|
||||
{/* Selected person card */}
|
||||
{v.selectedUser && stat && (
|
||||
<div className="mt-2 flex items-center gap-3 rounded-[18px] border border-[color:var(--m-gbr)] bg-[color:var(--m-glass)] px-[14px] py-[9px]">
|
||||
@@ -208,6 +238,12 @@ export default function MVacay() {
|
||||
>
|
||||
{v.monthNamesShort[slot]}
|
||||
</button>
|
||||
{/* The columns named, where a wide window gives them room for it. */}
|
||||
<div aria-hidden="true" className="mb-[2px] hidden grid-cols-7 gap-[2px] wide:grid">
|
||||
{weekdayLetters.map((letter, i) => (
|
||||
<span key={i} className="text-center font-geist text-[length:calc(8px*var(--fs-scale-caption,1))] font-bold uppercase text-m-faint">{letter}</span>
|
||||
))}
|
||||
</div>
|
||||
<MVacayMonth
|
||||
year={year}
|
||||
month={month}
|
||||
@@ -277,7 +313,7 @@ export default function MVacay() {
|
||||
|
||||
{/* Mode switch (edit only) */}
|
||||
{edit && v.selectedUser && (
|
||||
<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="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)+16px)]">
|
||||
<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"
|
||||
@@ -342,7 +378,9 @@ export default function MVacay() {
|
||||
)}
|
||||
|
||||
{/* View/edit FAB. It sits in the dock's centre slot, which MBottomNav leaves
|
||||
empty on /vacay so this stays the only action there (#1811). */}
|
||||
empty on /vacay so this stays the only action there (#1811). A wide
|
||||
window has the rail instead, and the switch stands at its head. */}
|
||||
{!wide && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={v.toggleView}
|
||||
@@ -359,6 +397,7 @@ export default function MVacay() {
|
||||
: <PenLine size={24} strokeWidth={2.3} />}
|
||||
</span>
|
||||
</button>
|
||||
)}
|
||||
|
||||
{/* Sheets */}
|
||||
<MVacayInviteSheet open={v.sheet === 'invite'} onClose={() => v.setSheet(null)} />
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { chromeFitPadding, chromePan } from './atlasChrome';
|
||||
|
||||
// FE-ATLAS-CHROME-001 onwards: the atlas camera beside the touch shell's rail and header.
|
||||
|
||||
describe('atlas chrome insets', () => {
|
||||
it('FE-ATLAS-CHROME-001: nothing covering the map leaves the opening view alone', () => {
|
||||
expect(chromePan(undefined, -80, false)).toBeNull();
|
||||
expect(chromePan({ top: 0, start: 0 }, 40, false)).toBeNull();
|
||||
// A tall window: the far north is already below the header.
|
||||
expect(chromePan({ top: 62, start: 0 }, 83, false)).toBeNull();
|
||||
});
|
||||
|
||||
it('FE-ATLAS-CHROME-002: the world moves away from the rail, in either reading direction', () => {
|
||||
expect(chromePan({ top: 62, start: 100 }, 83, false)).toEqual([-50, 0]);
|
||||
expect(chromePan({ top: 62, start: 100 }, 83, true)).toEqual([50, 0]);
|
||||
});
|
||||
|
||||
it('FE-ATLAS-CHROME-004: on a short window the far north comes down from under the header, just as far as it needs', () => {
|
||||
expect(chromePan({ top: 62, start: 0 }, -77, false)).toEqual([0, -139]);
|
||||
});
|
||||
|
||||
it("FE-ATLAS-CHROME-003: a country is framed clear of the rail's side and the header", () => {
|
||||
expect(chromeFitPadding({ top: 62, start: 100 }, false)).toEqual({
|
||||
paddingTopLeft: [124, 86],
|
||||
paddingBottomRight: [24, 24],
|
||||
});
|
||||
expect(chromeFitPadding({ top: 62, start: 100 }, true)).toEqual({
|
||||
paddingTopLeft: [24, 86],
|
||||
paddingBottomRight: [124, 24],
|
||||
});
|
||||
expect(chromeFitPadding(undefined, false)).toEqual({ paddingTopLeft: [24, 24], paddingBottomRight: [24, 24] });
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* How much of the atlas map's edges a screen's own chrome covers, in px: the
|
||||
* touch shell's rail along the leading edge, its floating header along the top.
|
||||
* The phone screen measures them (MAtlas), the camera keeps clear of them.
|
||||
*/
|
||||
export interface AtlasChromeInsets {
|
||||
top: number;
|
||||
start: number;
|
||||
}
|
||||
|
||||
/** Arabic runs right to left, and the rail stands on the right then. */
|
||||
function documentRtl(): boolean {
|
||||
return typeof document !== 'undefined' && document.documentElement.dir === 'rtl';
|
||||
}
|
||||
|
||||
/** The northern edge of the inhabited world, which the opening view keeps below the header. */
|
||||
export const NORTH_EDGE_LAT = 75;
|
||||
|
||||
/**
|
||||
* The pan that fits the opening view to what the chrome leaves free, or null
|
||||
* when there is nothing to move. Sideways the centre moves into the middle of
|
||||
* the map beside the rail. Upwards the world moves down only as far as its
|
||||
* inhabited top (NORTH_EDGE_LAT, at `northEdgeY` in the map's own pixels) needs
|
||||
* to clear the header: a tall window shows it below the header anyway, a phone
|
||||
* had the stars of the far north under it. Leaflet pans the camera, so the
|
||||
* numbers point the other way from the world's move.
|
||||
*/
|
||||
export function chromePan(
|
||||
insets: AtlasChromeInsets | undefined,
|
||||
northEdgeY: number,
|
||||
rtl = documentRtl()
|
||||
): [number, number] | null {
|
||||
if (!insets) return null;
|
||||
const x = insets.start ? (rtl ? 1 : -1) * (insets.start / 2) : 0;
|
||||
const y = Math.min(0, northEdgeY - insets.top);
|
||||
return x || y ? [x, y] : null;
|
||||
}
|
||||
|
||||
/** The padding a country is framed with, wider on the rail's side and under the header. */
|
||||
export function chromeFitPadding(
|
||||
insets: AtlasChromeInsets | undefined,
|
||||
rtl = documentRtl()
|
||||
): { paddingTopLeft: [number, number]; paddingBottomRight: [number, number] } {
|
||||
const start = insets?.start ?? 0;
|
||||
return {
|
||||
paddingTopLeft: [24 + (rtl ? 0 : start), 24 + (insets?.top ?? 0)],
|
||||
paddingBottomRight: [24 + (rtl ? start : 0), 24],
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useCallback, useEffect, useMemo, useState, useRef } from 'react'
|
||||
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useState, useRef } from 'react'
|
||||
import { useNavigate } from 'react-router'
|
||||
import { getIntlLanguage, getLocaleForLanguage, useTranslation } from '../../i18n'
|
||||
import { getLocaleForLanguage, useTranslation } from '../../i18n'
|
||||
import { useSettingsStore } from '../../store/settingsStore'
|
||||
import { useTileUrl } from '../../hooks/useTileUrl'
|
||||
import { OFM_DARK, OFM_POSITRON } from '../../constants/mapDefaults'
|
||||
@@ -19,20 +19,11 @@ import { usePlaceLanguage } from '../../hooks/usePlaceLanguage'
|
||||
import { useServerPing } from '../../sync/useServerPing'
|
||||
import type { AtlasConfirmAction, VisitedRegionMap } from './useAtlasCountryActions'
|
||||
import { createWishlistPattern, svgWishlistFill } from './atlasWishlistFill'
|
||||
import { chromeFitPadding, chromePan, NORTH_EDGE_LAT, type AtlasChromeInsets } from './atlasChrome'
|
||||
import { useCountryNames } from './useCountryNames'
|
||||
|
||||
const PLANNED_KEY = 'trek_atlas_show_planned'
|
||||
|
||||
function useCountryNames(language: string): (code: string) => string {
|
||||
const [resolver, setResolver] = useState<(code: string) => string>(() => (code: string) => code)
|
||||
useEffect(() => {
|
||||
try {
|
||||
const dn = new Intl.DisplayNames([getIntlLanguage(language)], { type: 'region' })
|
||||
setResolver(() => (code: string) => { try { return dn.of(code) || code } catch { return code } })
|
||||
} catch { /* */ }
|
||||
}, [language])
|
||||
return resolver
|
||||
}
|
||||
|
||||
/**
|
||||
* Atlas page logic — the whole interactive globe lives here: atlas/bucket-list
|
||||
* loading, the Leaflet map lifecycle (country + sub-national region layers,
|
||||
@@ -41,7 +32,9 @@ function useCountryNames(language: string): (code: string) => string {
|
||||
* the returned state via its presentational SidebarContent helper.
|
||||
* Behaviour is identical to the previous in-component logic.
|
||||
*/
|
||||
export function useAtlas() {
|
||||
export function useAtlas(options: { chromeInsets?: () => AtlasChromeInsets } = {}) {
|
||||
const chromeInsetsRef = useRef(options.chromeInsets)
|
||||
useLayoutEffect(() => { chromeInsetsRef.current = options.chromeInsets })
|
||||
const { t, language } = useTranslation()
|
||||
const placeLang = usePlaceLanguage()
|
||||
const { settings } = useSettingsStore()
|
||||
@@ -380,6 +373,9 @@ export function useAtlas() {
|
||||
map.getPane('regionPane')!.style.zIndex = '401'
|
||||
|
||||
mapInstance.current = map
|
||||
// The opening view centres the world beside the screen's chrome, not behind the rail and under the header.
|
||||
const pan = chromePan(chromeInsetsRef.current?.(), map.latLngToContainerPoint([NORTH_EDGE_LAT, 0]).y)
|
||||
if (pan) map.panBy(pan, { animate: false })
|
||||
// Both renderers live as long as the map does (see the note on the refs); map.remove()
|
||||
// disposes them along with every other layer it holds.
|
||||
countryRendererRef.current = L.canvas({ padding: 0.5, tolerance: 5 })
|
||||
@@ -954,7 +950,8 @@ export function useAtlas() {
|
||||
const layer = country_layer_by_a2_ref.current[country_code]
|
||||
try {
|
||||
if (layer?.getBounds && mapInstance.current) {
|
||||
mapInstance.current.fitBounds(layer.getBounds(), { padding: [24, 24], animate: true, maxZoom: 6 })
|
||||
const padding = chromeFitPadding(chromeInsetsRef.current?.())
|
||||
mapInstance.current.fitBounds(layer.getBounds(), { ...padding, animate: true, maxZoom: 6 })
|
||||
}
|
||||
} catch (e ) {
|
||||
console.error('Error fitting bounds', e)
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { getIntlLanguage } from '../../i18n';
|
||||
|
||||
/** A country's name in the reader's language, from its ISO code; the code itself where none is known. */
|
||||
export function useCountryNames(language: string): (code: string) => string {
|
||||
const [resolver, setResolver] = useState<(code: string) => string>(() => (code: string) => code);
|
||||
useEffect(() => {
|
||||
try {
|
||||
const dn = new Intl.DisplayNames([getIntlLanguage(language)], { type: 'region' });
|
||||
setResolver(() => (code: string) => {
|
||||
try {
|
||||
return dn.of(code) || code;
|
||||
} catch {
|
||||
return code;
|
||||
}
|
||||
});
|
||||
} catch {
|
||||
/* no region names in this runtime: the codes stand */
|
||||
}
|
||||
}, [language]);
|
||||
return resolver;
|
||||
}
|
||||
@@ -259,4 +259,25 @@ describe('MBottomNav', () => {
|
||||
});
|
||||
expect([placeholder.left.children.length, placeholder.right.children.length]).toEqual(groups);
|
||||
});
|
||||
|
||||
it("FE-MOB-NAV-020: More is marked for its screens with a ring, not the centre button's fill", () => {
|
||||
seedAddons(['vacay', 'atlas', 'journey', 'collections']);
|
||||
nav('/atlas');
|
||||
const more = screen.getByRole('button', { name: 'More' });
|
||||
expect(more).toHaveAttribute('aria-current', 'page');
|
||||
expect(more.className).toContain('ring-[color:var(--m-act)]');
|
||||
expect(more.className).not.toContain('bg-m-act');
|
||||
});
|
||||
|
||||
it('FE-MOB-NAV-021: a list fades out under the dock, a map runs to the edge', () => {
|
||||
seedAddons(['atlas', 'journey']);
|
||||
const dashboard = nav('/dashboard');
|
||||
expect(dashboard.container.querySelector('.m-dock-scrim')).toBeInTheDocument();
|
||||
dashboard.unmount();
|
||||
for (const path of ['/atlas', '/journey/3']) {
|
||||
const screenOverMap = nav(path);
|
||||
expect([path, screenOverMap.container.querySelector('.m-dock-scrim')]).toEqual([path, null]);
|
||||
screenOverMap.unmount();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { FolderOpen, Map as MapIcon } from 'lucide-react';
|
||||
import { FolderOpen, Map as MapIcon, PenLine } from 'lucide-react';
|
||||
import { useLocation } from 'react-router';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import MNavRail from '../../../src/mobile/components/MNavRail';
|
||||
import { useScreenRailAction } from '../../../src/mobile/components/railAction';
|
||||
import MobileShell from '../../../src/mobile/MobileShell';
|
||||
import MTripRail from '../../../src/mobile/screens/trip/MTripRail';
|
||||
import { useAddonStore } from '../../../src/store/addonStore';
|
||||
@@ -86,6 +87,43 @@ describe('MNavRail', () => {
|
||||
render(<MNavRail />, { initialEntries: ['/settings'] });
|
||||
expect(within(rail()).getAllByRole('button')[0]).toHaveAccessibleName('My Trips');
|
||||
});
|
||||
|
||||
it('FE-MOB-RAIL-009: the head is the same 56px circle on every top-level page, so no entry moves', () => {
|
||||
const head = () => rail().firstElementChild?.firstElementChild as HTMLElement;
|
||||
for (const path of ['/dashboard', '/atlas', '/settings', '/admin', '/vacay']) {
|
||||
const { unmount } = render(<MNavRail />, { initialEntries: [path] });
|
||||
expect([path, head().className]).toEqual([path, expect.stringContaining('h-14 w-14')]);
|
||||
unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it("FE-MOB-RAIL-010: on the vacation calendar the head is the screen's own switch", () => {
|
||||
const toggle = vi.fn();
|
||||
function Vacay({ editing }: { editing: boolean }) {
|
||||
useScreenRailAction({ label: editing ? 'Year' : 'Edit calendar', icon: PenLine, pressed: editing, run: toggle });
|
||||
return null;
|
||||
}
|
||||
const { rerender } = render(
|
||||
<>
|
||||
<MNavRail />
|
||||
<Vacay editing={false} />
|
||||
</>,
|
||||
{ initialEntries: ['/vacay'] }
|
||||
);
|
||||
const first = within(rail()).getAllByRole('button')[0];
|
||||
expect(first).toHaveAccessibleName('Edit calendar');
|
||||
fireEvent.click(first);
|
||||
expect(toggle).toHaveBeenCalledOnce();
|
||||
|
||||
rerender(
|
||||
<>
|
||||
<MNavRail />
|
||||
<Vacay editing />
|
||||
</>
|
||||
);
|
||||
expect(within(rail()).getAllByRole('button')[0]).toHaveAccessibleName('Year');
|
||||
expect(within(rail()).getAllByRole('button')[0].className).toContain('border-2');
|
||||
});
|
||||
});
|
||||
|
||||
describe('MTripRail', () => {
|
||||
@@ -162,6 +200,19 @@ describe('MobileShell on a wide window', () => {
|
||||
expect(screen.getByLabelText('note')).toBe(field);
|
||||
});
|
||||
|
||||
it('FE-MOB-RAIL-011: the rail comes before the page, so a keyboard reaches the navigation first', () => {
|
||||
setSizeClass('wide');
|
||||
const { container } = render(
|
||||
<MobileShell isPhone>
|
||||
<button type="button">in the page</button>
|
||||
</MobileShell>,
|
||||
{ initialEntries: ['/dashboard'] }
|
||||
);
|
||||
const page = screen.getByRole('button', { name: 'in the page' });
|
||||
expect(rail().compareDocumentPosition(page) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
|
||||
expect(container.querySelector('.m-shell')?.getAttribute('data-size')).toBe('wide');
|
||||
});
|
||||
|
||||
it('FE-MOB-RAIL-008: no rail inside a trip, which brings its own', () => {
|
||||
setSizeClass('wide');
|
||||
render(
|
||||
|
||||
@@ -62,4 +62,14 @@ describe('MCollPlaceRow', () => {
|
||||
expect(props.onToggleSelect).toHaveBeenCalledWith(7)
|
||||
expect(props.onOpen).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('FE-MOB-COLL-013: one card holds the place and its pills, the status worded in a readable mix of its colour', () => {
|
||||
renderRow()
|
||||
const status = screen.getByRole('button', { name: 'Want to go' })
|
||||
const place = screen.getByText('Jungfernstieg').closest('button') as HTMLElement
|
||||
// Both inside the same card, not in a card of their own beside it.
|
||||
expect(status.closest('.rounded-2xl')).toBe(place.parentElement)
|
||||
expect(status.style.color).toContain('color-mix')
|
||||
expect(status.style.color).toContain('var(--m-ink)')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -2,7 +2,7 @@ import userEvent from '@testing-library/user-event';
|
||||
import { Settings2, Users } from 'lucide-react';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import { MRailButton } from '../../../src/mobile/components/MRail';
|
||||
import { MRail, MRailButton } from '../../../src/mobile/components/MRail';
|
||||
import MSectionNav from '../../../src/mobile/components/MSectionNav';
|
||||
import MCollListNav from '../../../src/mobile/screens/collections/MCollListNav';
|
||||
import MJourneyFeed from '../../../src/mobile/screens/journey/MJourneyFeed';
|
||||
@@ -25,68 +25,62 @@ import { setSizeClass } from '../../helpers/sizeClass';
|
||||
const echo = (key: string, params?: Record<string, string | number>) =>
|
||||
params ? `${key}:${Object.values(params).join(',')}` : key;
|
||||
|
||||
describe('rail labels that fit', () => {
|
||||
// jsdom lays nothing out, so the label measures what these getters say: a word
|
||||
// `width` px wide at full size in a 64px box, narrower once it may hyphenate.
|
||||
function measureLike(width: number, hyphenated: number) {
|
||||
const proto = HTMLSpanElement.prototype;
|
||||
vi.spyOn(proto, 'scrollWidth', 'get').mockImplementation(function (this: HTMLElement) {
|
||||
const fit = Number(this.style.getPropertyValue('--fit') || 1);
|
||||
return (this.style.hyphens === 'auto' ? hyphenated : width) * fit;
|
||||
describe('rail labels', () => {
|
||||
// jsdom lays nothing out: a name measures as two lines when its scrollHeight
|
||||
// says so, against the 12px line its computed style reports.
|
||||
function measureLike(twoLines: string[]) {
|
||||
vi.spyOn(HTMLSpanElement.prototype, 'scrollHeight', 'get').mockImplementation(function (this: HTMLElement) {
|
||||
return twoLines.includes(this.textContent ?? '') ? 24 : 12;
|
||||
});
|
||||
const real = window.getComputedStyle;
|
||||
vi.spyOn(window, 'getComputedStyle').mockImplementation((el, pseudo) => {
|
||||
const style = real(el, pseudo);
|
||||
return new Proxy(style, {
|
||||
get: (target, prop) => (prop === 'lineHeight' ? '12px' : Reflect.get(target, prop)),
|
||||
});
|
||||
});
|
||||
vi.spyOn(proto, 'clientWidth', 'get').mockReturnValue(64);
|
||||
}
|
||||
|
||||
afterEach(() => vi.restoreAllMocks());
|
||||
|
||||
function label() {
|
||||
return screen.getByText('Einstellungen');
|
||||
function railOf(names: string[]) {
|
||||
return render(
|
||||
<MRail label="Navigation">
|
||||
{names.map((name) => (
|
||||
<MRailButton key={name} label={name} active={false} onClick={() => {}}>
|
||||
x
|
||||
</MRailButton>
|
||||
))}
|
||||
</MRail>
|
||||
);
|
||||
}
|
||||
const list = () => screen.getByText('Atlas').closest('nav')?.lastElementChild as HTMLElement;
|
||||
|
||||
it('FE-MOB-PANES-001: a name that fits keeps its size and its words whole', () => {
|
||||
measureLike(60, 60);
|
||||
render(
|
||||
<MRailButton label="Einstellungen" active={false} onClick={() => {}}>
|
||||
x
|
||||
</MRailButton>
|
||||
);
|
||||
expect(label().style.getPropertyValue('--fit')).toBe('1');
|
||||
expect(label().style.hyphens).toBe('manual');
|
||||
expect(label().style.overflowWrap).toBe('normal');
|
||||
it('FE-MOB-PANES-001: every name is drawn at the one caption size, none shrunk to fit', () => {
|
||||
measureLike([]);
|
||||
railOf(['Atlas', 'Einstellungen']);
|
||||
for (const name of ['Atlas', 'Einstellungen']) {
|
||||
const label = screen.getByText(name);
|
||||
expect(label.className).toContain('text-[length:calc(10px*var(--fs-scale-caption,1))]');
|
||||
expect(label.style.getPropertyValue('--fit')).toBe('');
|
||||
}
|
||||
});
|
||||
|
||||
it('FE-MOB-PANES-002: a word a little too wide shrinks the name instead of splitting it', () => {
|
||||
measureLike(72, 40);
|
||||
render(
|
||||
<MRailButton label="Einstellungen" active={false} onClick={() => {}}>
|
||||
x
|
||||
</MRailButton>
|
||||
);
|
||||
const fit = Number(label().style.getPropertyValue('--fit'));
|
||||
expect(fit).toBeLessThan(1);
|
||||
expect(72 * fit).toBeLessThanOrEqual(64.5);
|
||||
expect(label().style.hyphens).toBe('manual');
|
||||
it('FE-MOB-PANES-002: names that all fit on one line keep the rail at one line each', () => {
|
||||
measureLike([]);
|
||||
railOf(['Atlas', 'Vacay', 'Journey']);
|
||||
expect(list().style.getPropertyValue('--m-rail-lines')).toBe('1');
|
||||
});
|
||||
|
||||
it('FE-MOB-PANES-003: a word too long even when small is hyphenated, and broken only past that', () => {
|
||||
measureLike(140, 60);
|
||||
const { unmount } = render(
|
||||
<MRailButton label="Einstellungen" active={false} onClick={() => {}}>
|
||||
x
|
||||
</MRailButton>
|
||||
);
|
||||
expect(label().style.hyphens).toBe('auto');
|
||||
expect(label().style.overflowWrap).toBe('normal');
|
||||
unmount();
|
||||
|
||||
vi.restoreAllMocks();
|
||||
measureLike(140, 140);
|
||||
render(
|
||||
<MRailButton label="Einstellungen" active={false} onClick={() => {}}>
|
||||
x
|
||||
</MRailButton>
|
||||
);
|
||||
expect(label().style.overflowWrap).toBe('anywhere');
|
||||
it('FE-MOB-PANES-003: one name on two lines gives every entry room for two, so the rhythm holds', () => {
|
||||
measureLike(['Мои поездки']);
|
||||
railOf(['Мои поездки', 'Atlas', 'Vacay']);
|
||||
expect(list().style.getPropertyValue('--m-rail-lines')).toBe('2');
|
||||
// Each name reserves the lines the rail settled on, and wraps balanced, hyphenating only a word too long.
|
||||
const label = screen.getByText('Atlas');
|
||||
expect(label.className).toContain('min-h-[calc(1.2em*var(--m-rail-lines,1))]');
|
||||
expect(label.className).toContain('[text-wrap:balance]');
|
||||
expect(label.className).toContain('[hyphens:auto]');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -427,7 +421,7 @@ describe('files as tiles and a preview', () => {
|
||||
expect(onMenu).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('FE-MOB-PANES-016: without the right to edit files the preview only opens', () => {
|
||||
it('FE-MOB-PANES-017: without the right to edit files the preview only opens', () => {
|
||||
vi.spyOn(fileRepo, 'previewUrl').mockResolvedValue('/signed/1');
|
||||
const planner = buildPlanner({ can: vi.fn(() => false) } as never);
|
||||
render(
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import MGlassBar from '../../../src/mobile/components/MGlassBar';
|
||||
import { render, screen } from '../../helpers/render';
|
||||
|
||||
// FE-MOB-CHROME-001 onwards: the touch shell's own chrome against what the
|
||||
// desktop pages bring along.
|
||||
|
||||
const root = resolve(__dirname, '../../..');
|
||||
|
||||
describe('desktop chrome inside the touch shell', () => {
|
||||
it('FE-MOB-CHROME-001: a page without a phone screen shows no desktop navbar over the rail, and keeps no room for it', () => {
|
||||
// /plugins/:id, /help and a trip's files still render through PageShell. jsdom
|
||||
// applies no stylesheet, so the rule and the mark it needs are read from source.
|
||||
const css = readFileSync(resolve(root, 'src/mobile/mobile.css'), 'utf8');
|
||||
expect(css).toMatch(/html:has\(\.m-shell\) \{\s*--nav-h: 0px;\s*\}/);
|
||||
expect(css).toMatch(/html:has\(\.m-shell\) \[data-desktop-navbar\] \{\s*display: none;\s*\}/);
|
||||
const navbar = readFileSync(resolve(root, 'src/components/Layout/Navbar.tsx'), 'utf8');
|
||||
expect(navbar).toContain('data-desktop-navbar=""');
|
||||
});
|
||||
});
|
||||
|
||||
describe('MGlassBar', () => {
|
||||
it('FE-MOB-CHROME-002: a floating bar stands in the content column, padded and capped like it', () => {
|
||||
render(
|
||||
<MGlassBar column="wide:max-w-[1280px]">
|
||||
<span>bar</span>
|
||||
</MGlassBar>
|
||||
);
|
||||
const bar = screen.getByText('bar').parentElement as HTMLElement;
|
||||
const column = bar.parentElement as HTMLElement;
|
||||
expect(column.className).toContain('px-4');
|
||||
expect(column.className).toContain('wide:px-6');
|
||||
expect(column.className).toContain('wide:max-w-[1280px]');
|
||||
expect(column.parentElement?.className).toContain('m-span-x');
|
||||
// The strip around the bar lets taps through to the page.
|
||||
expect(column.parentElement?.className).toContain('pointer-events-none');
|
||||
expect(bar.className).toContain('pointer-events-auto');
|
||||
});
|
||||
|
||||
it('FE-MOB-CHROME-003: in flow it is the bar alone', () => {
|
||||
const { container } = render(
|
||||
<MGlassBar floating={false}>
|
||||
<span>bar</span>
|
||||
</MGlassBar>
|
||||
);
|
||||
expect(container.firstElementChild).toBe(screen.getByText('bar').parentElement);
|
||||
});
|
||||
});
|
||||
@@ -1,8 +1,10 @@
|
||||
// FE-MOB-MVACSCR-001 to FE-MOB-MVACSCR-021
|
||||
// FE-MOB-MVACSCR-001 to FE-MOB-MVACSCR-023
|
||||
import React from 'react';
|
||||
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { render, screen, fireEvent, within } from '../../../helpers/render';
|
||||
import MVacay from '../../../../src/mobile/screens/vacay/MVacay';
|
||||
import MNavRail from '../../../../src/mobile/components/MNavRail';
|
||||
import { setSizeClass } from '../../../helpers/sizeClass';
|
||||
import type { DayVisualContext } from '../../../../src/mobile/screens/vacay/vacayDayModel';
|
||||
|
||||
const mocks = vi.hoisted(() => ({ v: {} as Record<string, unknown> }));
|
||||
@@ -427,4 +429,30 @@ describe('MVacay', () => {
|
||||
rerender(<MVacay />);
|
||||
expect(container.firstElementChild).toHaveClass('h-dvh');
|
||||
});
|
||||
|
||||
it('FE-MOB-MVACSCR-022: on a wide window the switch stands at the head of the rail, not over the calendar', () => {
|
||||
setSizeClass('wide');
|
||||
render(
|
||||
<>
|
||||
<MNavRail />
|
||||
<MVacay />
|
||||
</>,
|
||||
{ initialEntries: ['/vacay'] }
|
||||
);
|
||||
const rail = screen.getByRole('navigation', { name: 'Navigation' });
|
||||
// One switch, and it is the rail's first button.
|
||||
expect(screen.getAllByRole('button', { name: 'Edit calendar' })).toHaveLength(1);
|
||||
const head = within(rail).getAllByRole('button')[0];
|
||||
expect(head).toHaveAccessibleName('Edit calendar');
|
||||
fireEvent.click(head);
|
||||
expect(mocks.v.toggleView).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('FE-MOB-MVACSCR-023: each month of the year grid names its weekday columns, from the first day of the week', () => {
|
||||
mocks.v = buildV({ weekStart: 0 });
|
||||
render(<MVacay />);
|
||||
const grid = screen.getAllByRole('button', { name: 'Jan' })[0].parentElement as HTMLElement;
|
||||
const letters = Array.from(grid.querySelectorAll('[aria-hidden="true"] > span')).map((el) => el.textContent);
|
||||
expect(letters).toEqual(['S', 'M', 'T', 'W', 'T', 'F', 'S']);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'الأماكن المحفوظة',
|
||||
'mobileNav.more': 'المزيد',
|
||||
'mobileNav.navigation': 'التنقل',
|
||||
'mobileNav.railSettings': 'الإعدادات',
|
||||
'mobileNav.railAdmin': 'الإدارة',
|
||||
'mobileNav.railCollections': 'المجموعات',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Saxlanılan məkanlar',
|
||||
'mobileNav.more': 'Daha çox',
|
||||
'mobileNav.navigation': 'Naviqasiya',
|
||||
'mobileNav.railSettings': 'Ayarlar',
|
||||
'mobileNav.railAdmin': 'Admin', // same-as-en
|
||||
'mobileNav.railCollections': 'Kolleksiyalar',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Lugares salvos',
|
||||
'mobileNav.more': 'Mais',
|
||||
'mobileNav.navigation': 'Navegação',
|
||||
'mobileNav.railSettings': 'Ajustes',
|
||||
'mobileNav.railAdmin': 'Admin', // same-as-en
|
||||
'mobileNav.railCollections': 'Coleções',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Llocs desats',
|
||||
'mobileNav.more': 'Més',
|
||||
'mobileNav.navigation': 'Navegació',
|
||||
'mobileNav.railSettings': 'Configuració',
|
||||
'mobileNav.railAdmin': 'Admin', // same-as-en
|
||||
'mobileNav.railCollections': 'Col·leccions',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Uložená místa',
|
||||
'mobileNav.more': 'Více',
|
||||
'mobileNav.navigation': 'Navigace',
|
||||
'mobileNav.railSettings': 'Nastavení',
|
||||
'mobileNav.railAdmin': 'Administrace',
|
||||
'mobileNav.railCollections': 'Sbírky',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Gespeicherte Orte',
|
||||
'mobileNav.more': 'Mehr',
|
||||
'mobileNav.navigation': 'Navigation', // same-as-en
|
||||
'mobileNav.railSettings': 'Einstellungen',
|
||||
'mobileNav.railAdmin': 'Admin', // same-as-en
|
||||
'mobileNav.railCollections': 'Sammlungen',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,10 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Saved places',
|
||||
'mobileNav.more': 'More',
|
||||
'mobileNav.navigation': 'Navigation',
|
||||
// The rail's own words, where a section's full name is too long for its 70px (MNavRail).
|
||||
'mobileNav.railSettings': 'Settings',
|
||||
'mobileNav.railAdmin': 'Admin',
|
||||
'mobileNav.railCollections': 'Collections',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Lugares guardados',
|
||||
'mobileNav.more': 'Más',
|
||||
'mobileNav.navigation': 'Navegación',
|
||||
'mobileNav.railSettings': 'Ajustes',
|
||||
'mobileNav.railAdmin': 'Admin', // same-as-en
|
||||
'mobileNav.railCollections': 'Colecciones',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Salvestatud kohad',
|
||||
'mobileNav.more': 'Veel',
|
||||
'mobileNav.navigation': 'Navigeerimine',
|
||||
'mobileNav.railSettings': 'Seaded',
|
||||
'mobileNav.railAdmin': 'Haldus',
|
||||
'mobileNav.railCollections': 'Kogumikud',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Lieux enregistrés',
|
||||
'mobileNav.more': 'Plus',
|
||||
'mobileNav.navigation': 'Navigation', // same-as-en
|
||||
'mobileNav.railSettings': 'Paramètres',
|
||||
'mobileNav.railAdmin': 'Admin', // same-as-en
|
||||
'mobileNav.railCollections': 'Collections', // same-as-en
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Αποθηκευμένες τοποθεσίες',
|
||||
'mobileNav.more': 'Περισσότερα',
|
||||
'mobileNav.navigation': 'Πλοήγηση',
|
||||
'mobileNav.railSettings': 'Ρυθμίσεις',
|
||||
'mobileNav.railAdmin': 'Διαχείριση',
|
||||
'mobileNav.railCollections': 'Συλλογές',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'מקומות שמורים',
|
||||
'mobileNav.more': 'עוד',
|
||||
'mobileNav.navigation': 'ניווט',
|
||||
'mobileNav.railSettings': 'הגדרות',
|
||||
'mobileNav.railAdmin': 'ניהול',
|
||||
'mobileNav.railCollections': 'אוספים',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Mentett helyek',
|
||||
'mobileNav.more': 'Több',
|
||||
'mobileNav.navigation': 'Navigáció',
|
||||
'mobileNav.railSettings': 'Beállítások',
|
||||
'mobileNav.railAdmin': 'Admin', // same-as-en
|
||||
'mobileNav.railCollections': 'Gyűjtemény',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Tempat tersimpan',
|
||||
'mobileNav.more': 'Lainnya',
|
||||
'mobileNav.navigation': 'Navigasi',
|
||||
'mobileNav.railSettings': 'Pengaturan',
|
||||
'mobileNav.railAdmin': 'Admin', // same-as-en
|
||||
'mobileNav.railCollections': 'Koleksi',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Luoghi salvati',
|
||||
'mobileNav.more': 'Altro',
|
||||
'mobileNav.navigation': 'Navigazione',
|
||||
'mobileNav.railSettings': 'Impostazioni',
|
||||
'mobileNav.railAdmin': 'Admin', // same-as-en
|
||||
'mobileNav.railCollections': 'Raccolte',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': '保存した場所',
|
||||
'mobileNav.more': 'その他',
|
||||
'mobileNav.navigation': 'ナビゲーション',
|
||||
'mobileNav.railSettings': '設定',
|
||||
'mobileNav.railAdmin': '管理',
|
||||
'mobileNav.railCollections': 'コレクション',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': '저장한 장소',
|
||||
'mobileNav.more': '더 보기',
|
||||
'mobileNav.navigation': '탐색',
|
||||
'mobileNav.railSettings': '설정',
|
||||
'mobileNav.railAdmin': '관리자',
|
||||
'mobileNav.railCollections': '컬렉션',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Opgeslagen plaatsen',
|
||||
'mobileNav.more': 'Meer',
|
||||
'mobileNav.navigation': 'Navigatie',
|
||||
'mobileNav.railSettings': 'Instellingen',
|
||||
'mobileNav.railAdmin': 'Beheer',
|
||||
'mobileNav.railCollections': 'Collecties',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Zapisane miejsca',
|
||||
'mobileNav.more': 'Więcej',
|
||||
'mobileNav.navigation': 'Nawigacja',
|
||||
'mobileNav.railSettings': 'Ustawienia',
|
||||
'mobileNav.railAdmin': 'Admin', // same-as-en
|
||||
'mobileNav.railCollections': 'Kolekcje',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Сохранённые места',
|
||||
'mobileNav.more': 'Ещё',
|
||||
'mobileNav.navigation': 'Навигация',
|
||||
'mobileNav.railSettings': 'Настройки',
|
||||
'mobileNav.railAdmin': 'Админ',
|
||||
'mobileNav.railCollections': 'Коллекции',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Uložené miesta',
|
||||
'mobileNav.more': 'Viac',
|
||||
'mobileNav.navigation': 'Navigácia',
|
||||
'mobileNav.railSettings': 'Nastavenia',
|
||||
'mobileNav.railAdmin': 'Správa',
|
||||
'mobileNav.railCollections': 'Zbierky',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Sparade platser',
|
||||
'mobileNav.more': 'Mer',
|
||||
'mobileNav.navigation': 'Navigering',
|
||||
'mobileNav.railSettings': 'Inställningar',
|
||||
'mobileNav.railAdmin': 'Admin', // same-as-en
|
||||
'mobileNav.railCollections': 'Samlingar',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'สถานที่ที่บันทึกไว้',
|
||||
'mobileNav.more': 'เพิ่มเติม',
|
||||
'mobileNav.navigation': 'การนำทาง',
|
||||
'mobileNav.railSettings': 'การตั้งค่า',
|
||||
'mobileNav.railAdmin': 'ผู้ดูแลระบบ',
|
||||
'mobileNav.railCollections': 'คอลเลกชัน',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Kaydedilen yerler',
|
||||
'mobileNav.more': 'Daha fazla',
|
||||
'mobileNav.navigation': 'Gezinme',
|
||||
'mobileNav.railSettings': 'Ayarlar',
|
||||
'mobileNav.railAdmin': 'Yönetici',
|
||||
'mobileNav.railCollections': 'Koleksiyonlar',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Збережені місця',
|
||||
'mobileNav.more': 'Більше',
|
||||
'mobileNav.navigation': 'Навігація',
|
||||
'mobileNav.railSettings': 'Налаштування',
|
||||
'mobileNav.railAdmin': 'Адмін',
|
||||
'mobileNav.railCollections': 'Колекції',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': 'Địa điểm đã lưu',
|
||||
'mobileNav.more': 'Thêm',
|
||||
'mobileNav.navigation': 'Điều hướng',
|
||||
'mobileNav.railSettings': 'Cài đặt',
|
||||
'mobileNav.railAdmin': 'Quản trị',
|
||||
'mobileNav.railCollections': 'Bộ sưu tập',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': '已儲存的地點',
|
||||
'mobileNav.more': '更多',
|
||||
'mobileNav.navigation': '導覽',
|
||||
'mobileNav.railSettings': '設定',
|
||||
'mobileNav.railAdmin': '管理',
|
||||
'mobileNav.railCollections': '收藏',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
@@ -5,6 +5,9 @@ const mobileNav: TranslationStrings = {
|
||||
'mobileNav.collectionsSub': '已保存的地点',
|
||||
'mobileNav.more': '更多',
|
||||
'mobileNav.navigation': '导航',
|
||||
'mobileNav.railSettings': '设置',
|
||||
'mobileNav.railAdmin': '管理',
|
||||
'mobileNav.railCollections': '收藏',
|
||||
};
|
||||
|
||||
export default mobileNav;
|
||||
|
||||
Reference in New Issue
Block a user