fix(roadtrip): the phone map loses the stage bar over the dock

It named the day's destination with its picture, its stop count, its arrival and the
stage distance, and it stood there for the whole of the road trip tab. The day and
the distance are in the shell's stage header already, and on a map that fills the
screen a permanent card over the bottom edge costs more than the three facts it
added. Tapping it opened the destination's stop sheet; the chain opens the same sheet
from the row that names it.

The slot stays for the one bar that earns it: while other ways of driving a leg are
on offer, the picker's bar stands there. That wrapper is now mounted with the bar
rather than lying empty over the map's own buttons the rest of the time, and the map
floor lifts only while it is up, so on the stage the round controls stand on the dock
like everywhere else.
This commit is contained in:
Maurice
2026-09-17 12:58:09 +02:00
parent 50f0641ad9
commit a250fa6339
6 changed files with 103 additions and 359 deletions
+15 -14
View File
@@ -311,27 +311,28 @@ export default function MMapArea({ planner, shell }: MMapAreaProps) {
// timeline (z-10) or the browse/tab overlays (z-30) above it.
//
// --m-map-floor is the top edge of whatever the map ends at: the dock, 62px tall at
// safe-bottom + 12, or on the road trip tab the stage bar, which takes the band the
// round controls would otherwise sit in and is what --m-stage-lift adds. The round
// controls sit straight on that floor and add their own 12px, close enough to the
// thumb to reach one-handed. Everything that reads --bottom-nav-h (the compass, both
// engines' locate button and base-layer switcher, the overview stack) follows on its
// own. The band used to float a further 38px up to leave the corner under it to the
// map credit; the phone map carries no visible credit any more (see mobile.css), so
// that row would now only be a gap over the dock.
// safe-bottom + 12, or the alternatives bar when the picker puts one over it, which is
// what --m-stage-lift adds. The round controls sit straight on that floor and add
// their own 12px, close enough to the thumb to reach one-handed. Everything that reads
// --bottom-nav-h (the compass, both engines' locate button and base-layer switcher,
// the overview stack) follows on its own. The band used to float a further 38px up to
// leave the corner under it to the map credit; the phone map carries no visible credit
// any more (see mobile.css), so that row would now only be a gap over the dock.
//
// The metrics are classes rather than an inline --bottom-nav-h, and the lift is its
// OWN variable folded into them: the compass band below is identified by being the
// one element that sets that name inline, and a second one would make that ambiguous.
<div
className="absolute inset-0 isolate overflow-hidden bg-[color:var(--m-mapb)] [--m-map-floor:calc(env(safe-area-inset-bottom,0px)+74px+var(--m-stage-lift,0px))] [--bottom-nav-h:var(--m-map-floor)]"
// 76px is the stage bar's own height plus the gap it keeps on both sides, so the
// round controls land one gap above the bar instead of on its top edge. While other
// ways of driving a leg are on offer their bar stands in that slot instead, taller,
// and the floor clears it the same way.
// A stage bar used to stand over the dock for the whole of the road trip tab, and the
// floor cleared its 61px plus a gap the year round. It is gone, so the only thing
// left in that slot is the bar the picker raises while other ways of driving a leg
// are on offer, and the floor clears that one the same way: its height plus the gap
// it keeps from the dock, so the round controls land above it rather than on its
// top edge.
style={{
['--m-stage-lift' as string]: onStage && mapActive
? (planner.routeAlternatives.open ? `${RT_ALT_BAR_LIFT}px` : '76px')
['--m-stage-lift' as string]: onStage && mapActive && planner.routeAlternatives.open
? `${RT_ALT_BAR_LIFT}px`
: '0px',
}}
>
@@ -7,14 +7,10 @@ import { useMRtAlternatives } from './useMRtAlternatives'
import MRtCorridorBar from './MRtCorridorBar'
import MRtAlternativesBar from './MRtAlternativesBar'
import { RtAutoRow, RtDryRow, RtLegRow, RtSpillRow, RtStopRow, type RowChrome } from './MRoadtripRows'
import { badgeLabel, distanceBadge } from './stageBadges'
import MBadge from '../../../components/MBadge'
import MDancingTrek from '../../../components/MDancingTrek'
import PlaceAvatar from '../../../../components/shared/PlaceAvatar'
import { dayColor } from '../../../../components/Roadtrip/dayColors'
import { formatDurationShort } from '../../../../components/Roadtrip/roadtripModel'
import { getNavigationTargets } from '../../../../components/Planner/placeNavigation'
import { useRoadtripSettings } from '../../../../hooks/useRoadtripSettings'
import { useSettingsStore } from '../../../../store/settingsStore'
import { formatDistance } from '../../../../utils/units'
import { isRtlLanguage } from '../../../../i18n'
@@ -84,29 +80,32 @@ export default function MRoadtripTab({ planner, shell }: MTripTabPanelProps) {
</div>
)
// ── Map half: the two bars, and nothing else. Everything between them belongs to the
// map instance the shell keeps mounted, so this layer must not swallow taps.
// ── Map half: the search bar, and the picker's bar while it is open. Everything
// between them belongs to the map instance the shell keeps mounted, so this layer must
// not swallow taps.
//
// While other ways of driving a leg are on offer, their bar takes the stage bar's slot
// and the search bar steps away. The picker is modal on the map: its lines are the
// A stage bar used to stand over the dock whenever the map was up: the day's
// destination with its picture, its stop count, its arrival and its distance. It went
// because the day and the distance are already in the shell's stage header, and on a
// map that fills the screen a permanent card over the bottom edge costs more than the
// three facts it added.
//
// While other ways of driving a leg are on offer, their bar stands in that now empty
// slot and the search bar steps away. The picker is modal on the map: its lines are the
// question on screen, a corridor search started under it would draw its pins over
// them, and the band it frees at the top is room the leg is framed into.
if (shell.rtView === 'map') {
return (
<div className="pointer-events-none absolute inset-0 z-20">
{!alts.open && searchBar}
{/* Just above the dock, the same gap everything else on this shell keeps from
it. Twenty pixels higher left a band of map between the two that read as a
gap rather than as breathing room, and pushed the map's own buttons into
the bar's top edge. */}
<div className="pointer-events-auto absolute left-4 right-4 bottom-[calc(var(--bottom-nav-h,84px)+4px)]">
{/* `rt` is handed down rather than looked up again: useMRoadtrip owns a
30s interval and a network subscription, and a second call would run a
second pair of them for the same screen. */}
{alts.open
? <MRtAlternativesBar planner={planner} alts={alts} />
: <StageBar planner={planner} rt={rt} onOpen={openStop} />}
</div>
{/* Just above the dock, the same gap everything else on this shell keeps from it.
Mounted only while the picker is open, so nothing invisible lies over the map's
own buttons the rest of the time. */}
{alts.open && (
<div className="pointer-events-auto absolute left-4 right-4 bottom-[calc(var(--bottom-nav-h,84px)+4px)]">
<MRtAlternativesBar planner={planner} alts={alts} />
</div>
)}
</div>
)
}
@@ -256,107 +255,6 @@ export default function MRoadtripTab({ planner, shell }: MTripTabPanelProps) {
)
}
/**
* The stage bar over the map: which day, where to, what it costs.
*
* One line rather than a sheet that can be dragged open. A drag sheet brings a panel
* height the map fit has to account for and lifts the locate and style buttons with
* it, which is a bigger change than this half of the screen needs to be useful.
*
* It reads as a place, so a tap opens that place's stop, the same sheet its row in the
* chain opens. It used to switch to the chain instead, which broke the promise its name
* makes; the header's list switch is the way back to the chain. Name, picture, clock and
* tap all come off one row (see stageEnd), so the bar can never name one stop and open
* another.
*
* It leads with a picture of that place rather than a coloured dot, because a place is
* recognised by how it looks long before its name is read. The facts beside it are badges
* rather than one line joined with dots: each one is a figure on its own, and a pill edge
* separates them at a glance where a middle dot has to be found first. Every badge is
* neutral. The whole bar is one button, and a filled pill inside it would read as a
* second control that does something else.
*
* Its height is a contract: 38px picture, a 39px text column, 10px padding and the border
* make the 61px the map area lifts its round buttons over (--m-stage-lift in MMapArea).
* Growing the picture or a badge moves those buttons into the bar's top edge.
*/
function StageBar({ planner, rt, onOpen }: {
planner: MTripTabPanelProps['planner']
rt: ReturnType<typeof useMRoadtrip>
onOpen: (row: StopRow) => void
}) {
const { t } = planner
const unit = useSettingsStore(s => s.settings.distance_unit)
const dayColorsOn = useRoadtripSettings(s => s.roadtrip_day_colors, planner.tripId)
const stage = rt.stage
if (!stage) {
// No stage means the day filter is off, which on the map is the whole drive. Its total
// is left out while nothing is measured, rather than printed as a drive of 0 m.
const total = distanceBadge(planner.roadtripRoutes.totalDistance, unit)
return (
<div className="flex items-center gap-2.5 rounded-[22px] border border-[color:var(--m-cbr)] bg-[color:var(--m-card)] px-[14px] py-[11px] shadow-[0_16px_44px_-14px_rgba(0,0,0,.35)] backdrop-blur-[24px] backdrop-saturate-[1.6]">
<span className="min-w-0 flex-1 truncate text-[0.8125rem] font-semibold text-m-ink">{t('roadtrip.title')}</span>
{total && <MBadge size="sm" caps={false}>{total}</MBadge>}
</div>
)
}
const tint = dayColorsOn ? dayColor(stage.dayNumber) : null
const end = rt.end
const name = end?.stop.name ?? t('roadtrip.stop.none')
const stopCount = t('roadtrip.day.stopCount', { count: rt.stops })
const distance = distanceBadge(stage.distance, unit)
const pending = t('roadtrip.leg.pending')
const inner = (
<>
{/* Hidden from the name, which the title already carries: the photo's alt text is the
place name a second time. The day colour rings the picture when the day colours
are on, because the ring is what ties this bar to its own line on the map. */}
<span
aria-hidden="true"
className="flex h-[38px] w-[38px] flex-none items-center justify-center overflow-hidden rounded-full border-2 border-[color:var(--m-avbr)] bg-[color:var(--m-ic)] text-m-muted"
// theme-lint-disable: map paint, see dayColors.ts.
style={tint ? { borderColor: tint.line } : undefined}
>
{/* Keyed by place: the avatar takes its photo from the first place it is handed and
keeps it while a new one is still loading or has none, so without a remount a
swipe to the next day would still picture the previous day's destination. */}
{rt.endPlace ? (
<PlaceAvatar key={rt.endPlace.id} place={rt.endPlace} category={rt.endCategory} size={34} />
) : (
<MapPin size={16} strokeWidth={2} />
)}
</span>
<span className="min-w-0 flex-1">
<span className="block truncate text-[0.8125rem] font-semibold leading-[18px] text-m-ink">{name}</span>
<span className="mt-[3px] flex min-w-0 items-center gap-[5px] overflow-hidden">
<MBadge>{stopCount}</MBadge>
{/* dir=ltr for the reason the rows carry it: a clock reads the same way round in an RTL locale. */}
{end?.time && <MBadge caps={false}><span dir="ltr">{end.time}</span></MBadge>}
</span>
</span>
{distance ? <MBadge size="sm" caps={false}>{distance}</MBadge> : <MBadge size="sm">{pending}</MBadge>}
</>
)
const box = 'flex w-full items-center gap-2.5 rounded-[22px] border border-[color:var(--m-cbr)] bg-[color:var(--m-card)] px-[11px] py-[10px] text-left shadow-[0_16px_44px_-14px_rgba(0,0,0,.35)] backdrop-blur-[24px] backdrop-saturate-[1.6]'
// A stage without a single stop has nothing for a tap to open, so a plain block rather
// than a dead button, the rule the whole-drive line above follows too.
if (!end) return <div className={box}>{inner}</div>
return (
<button
type="button"
onClick={() => onOpen(end)}
aria-label={badgeLabel([name, stopCount, end.time, distance ?? pending])}
className={box}
>
{inner}
</button>
)
}
/**
* What is coming up, measured against the clock rather than the plan.
*
@@ -12,10 +12,10 @@ export const RT_ALT_BAR_HEIGHT = 174
/**
* How far the map floor rises while the alternatives bar stands over the dock, in pixels.
*
* The bar's height plus the same 15px the 76px stage lift adds to the 61px stage bar: the
* gap between the top of the dock and the foot of a bar standing over it. So the floor
* lands on this bar's top edge as it lands on that one's, and the credit and the round
* controls clear this bar the way they clear that one.
* The bar's height plus the 15px gap between the top of the dock and the foot of a bar
* standing over it. So the floor lands on this bar's top edge and the round controls
* clear it rather than sitting in it. It is the only bar left in that slot: the stage bar
* that used to hold it whenever the map was up is gone.
*
* A number rather than a CSS length because the map's fit padding is added up from it.
* Kept in this module rather than in the bar's, so the map area reads it without pulling