fix(tours): keep the road trip's vias on their legs when stages spread, and ask on the phone too

Spreading a multi-day tour wrote through the store directly and skipped
the via re-anchoring every other write on the plan does. A tour with a
start counts as a road-trip stop, so taking the whole tour, a stale stage
or a moved stage off the middle of a day shifted every later stop, and the
vias anchored by position shaped the wrong leg. The undo had the same gap
when it put the whole tour back mid-day. Each stop a spread or its undo
takes off a day now carries the day's vias along (reanchorAfterRemove),
and the whole tour put back carries them the other way
(reanchorAfterInsert). The stops are read from the store as each write
goes out and the vias are kept as the last correction left them, since
one run can touch a day twice before the plan renders.

The phone's place sheet greyed out a day that holds a multi-day tour, so
its stages could not be spread from there. It now checks the day the way
the desktop menus do and leaves the choice to the plan, which opens the
card with only the stages offered.

The second step of the day menu names the day picked, and a greyed-out
"Whole tour on this day" says why right under it. The toast for a tour
that sat whole on several days now says "days" instead of "day", in all
27 languages.
This commit is contained in:
Maurice
2026-10-20 22:16:40 +02:00
parent bafb74f872
commit 3e8d192305
39 changed files with 361 additions and 39 deletions
+23 -1
View File
@@ -10,6 +10,10 @@ interface MenuItem {
disabled?: boolean
danger?: boolean
divider?: boolean
/** A second, quieter line under the label: what an item does, or why it is greyed out. */
hint?: string
/** A row that only names what the items below it act on, such as the day picked a step before. */
heading?: boolean
}
interface MenuState {
@@ -115,6 +119,14 @@ export function ContextMenu({ menu, onClose }: ContextMenuProps) {
}}>
{menu.items.filter(Boolean).map((item, i) => {
if (item.divider) return <div key={i} style={{ height: 1, background: 'var(--border-faint)', margin: '3px 6px' }} />
if (item.heading) return (
<div key={i} style={{
padding: '6px 10px 4px', fontSize: 'calc(11px * var(--fs-scale-caption, 1))', fontWeight: 600,
color: 'var(--text-faint)',
}}>
{item.label}
</div>
)
const Icon = item.icon
return (
<button type="button" key={i} disabled={item.disabled} onClick={() => { if (item.disabled) return; item.onClick?.(); onClose() }} style={{
@@ -129,7 +141,17 @@ export function ContextMenu({ menu, onClose }: ContextMenuProps) {
onMouseLeave={e => e.currentTarget.style.background = 'none'}
>
{Icon && <Icon size={13} style={{ flexShrink: 0, color: item.danger ? '#ef4444' : 'var(--text-faint)' }} />}
<span>{item.label}</span>
{item.hint ? (
<span style={{ display: 'flex', flexDirection: 'column', gap: 1, minWidth: 0 }}>
<span>{item.label}</span>
<span style={{
maxWidth: 240, whiteSpace: 'normal', fontWeight: 400, color: 'var(--text-muted)',
fontSize: 'calc(11px * var(--fs-scale-caption, 1))',
}}>
{item.hint}
</span>
</span>
) : <span>{item.label}</span>}
</button>
)
})}