feat(planner): bring the plan tab and every trip dialog into the new look

The Plan tab was the last trip tab still in the old design. It now reads
like Bookings, Costs, Lists, Files and Collab, without losing a function:

- Day plan: each day is a card with a head band (day tile with weather,
  stay and rental pills, a "+" menu for place, stay, transport, transit
  and note), rows with "..." menus, white badges and a white route bar.
- Places column: add, search and filters in three rows, a show dropdown,
  category and rating filters, and a selection bar at the foot.
- Place inspector, day details and the stay editor on the shared dialog
  frame; the place form in the editor look with the name in the head band.
- Clicking a booking or transport anywhere on the plan opens the booking
  detail popup first; Edit leads to the editor. The popup is one host
  shared with the Bookings and Transports tabs.
- Files and Collab dialogs, notes, polls, links and chat moved to the same
  frame; shared DialogShell and dialogParts hold the building blocks.
- The map hover card shows the place photo and follows the theme.

Every new and reworded string is translated into all locales, and a few
older English leftovers (help center, cost split, import hints) with them.
Phone screens keep their own look.
This commit is contained in:
Maurice
2026-09-27 21:00:19 +02:00
parent acd0d6511e
commit 0dd07befa7
314 changed files with 17106 additions and 10400 deletions
@@ -1,10 +1,13 @@
import React from 'react'
import React, { useId } from 'react'
import Markdown from 'react-markdown'
import remarkGfm from 'remark-gfm'
import { Plus, Check, Star } from 'lucide-react'
import PlaceAvatar from '../shared/PlaceAvatar'
import { Tooltip } from '../shared/Tooltip'
import { fs } from '../shared/DialogShell'
import { getCategoryIcon } from '../shared/categoryIcons'
import { resolveTrackColor } from '../Map/trackColors'
import { MoreButton, SoftPill, type MenuEntry } from './planParts'
import type { Place, Category } from '../../types'
interface MemoPlaceRowProps {
@@ -21,6 +24,8 @@ interface MemoPlaceRowProps {
t: (key: string, params?: Record<string, any>) => string
onPlaceClick: (id: number | null) => void
onContextMenu: (e: React.MouseEvent, place: Place) => void
/** The same entries as the right-click menu, for the row's "…". */
menuItems: (place: Place, dayId: number | null) => MenuEntry[]
onAssignToDay: (placeId: number, dayId?: number) => void
toggleSelected: (id: number) => void
setDayPickerPlace: (place: any) => void
@@ -28,13 +33,17 @@ interface MemoPlaceRowProps {
}
export const MemoPlaceRow = React.memo(function MemoPlaceRow({
place, category: cat, isSelected, isPlanned, inDay, isChecked,
selectMode, selectedDayId, canEditPlaces, isMobile, t,
onPlaceClick, onContextMenu, onAssignToDay, toggleSelected, setDayPickerPlace, registerPlaceRow,
place, category: cat, isSelected, inDay, isChecked,
selectMode, selectedDayId, isMobile, t,
onPlaceClick, onContextMenu, menuItems, onAssignToDay, toggleSelected, setDayPickerPlace, registerPlaceRow,
}: MemoPlaceRowProps) {
const nameId = useId()
const hasGeometry = Boolean(place.route_geometry)
// Touch is reached through a long press instead of being locked out (#1616).
const dragDisabled = isMobile
const showAddToDay = !selectMode && !inDay && selectedDayId !== null
// Below lg a tap opens the day picker sheet, which carries the same actions.
const showMore = !selectMode && !isMobile
// One place for what a row does, so the keyboard path below cannot drift from the click.
const activate = () => {
if (selectMode) {
@@ -45,13 +54,21 @@ export const MemoPlaceRow = React.memo(function MemoPlaceRow({
onPlaceClick(isSelected ? null : place.id)
}
}
let tone = 'hover:bg-surface-hover'
if (isChecked) tone = 'bg-accent-subtle'
else if (isSelected) tone = 'bg-surface-selected'
const CatIcon = cat ? getCategoryIcon(cat.icon) : null
const hasRating = (place.rating_count ?? 0) > 0 && place.rating_avg != null
const subline = place.description || place.address || cat?.name
return (
<div
key={place.id}
ref={element => registerPlaceRow(place.id, element)}
role="option"
tabIndex={0}
aria-selected={isSelected}
// Named by the place alone: the indicators, the rating and the buttons inside
// would otherwise run into the name a screen reader (and a test) reads first.
aria-labelledby={nameId}
data-place-id={place.id}
draggable={!selectMode && !dragDisabled}
onDragStart={e => {
@@ -62,88 +79,77 @@ export const MemoPlaceRow = React.memo(function MemoPlaceRow({
}}
onClick={activate}
onKeyDown={e => {
// Only when the row itself has focus — the "+" button inside it keeps its own key handling.
// Only when the row itself has focus — the buttons inside it keep their own key handling.
if (e.target !== e.currentTarget) return
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); activate() }
}}
onContextMenu={selectMode ? undefined : e => onContextMenu(e, place)}
style={{
display: 'flex', alignItems: 'center', gap: 10,
padding: '9px 14px 9px 16px',
cursor: selectMode || dragDisabled ? 'pointer' : 'grab',
background: isChecked ? 'color-mix(in srgb, var(--accent) 8%, transparent)' : isSelected ? 'var(--border-faint)' : 'transparent',
borderBottom: '1px solid var(--border-faint)',
transition: 'background 0.1s',
contentVisibility: 'auto',
containIntrinsicSize: '0 52px',
}}
onMouseEnter={e => { if (!isSelected && !isChecked) e.currentTarget.style.background = 'var(--bg-hover)' }}
onMouseLeave={e => { if (!isSelected && !isChecked) e.currentTarget.style.background = 'transparent' }}
className={`group mb-px flex items-center gap-2.5 rounded-[12px] px-2.5 py-2 outline-none transition-colors focus-visible:ring-2 focus-visible:ring-[color:var(--text-primary)] ${tone} ${selectMode || dragDisabled ? 'cursor-pointer' : 'cursor-grab'}`}
style={{ contentVisibility: 'auto', containIntrinsicSize: '0 52px' }}
>
{selectMode && (
<div className={isChecked ? 'bg-accent' : 'bg-transparent'} style={{
width: 16, height: 16, borderRadius: 4, flexShrink: 0,
border: isChecked ? 'none' : '1.5px solid var(--border-primary)',
display: 'flex', alignItems: 'center', justifyContent: 'center',
}}>
{isChecked && <Check size={10} strokeWidth={3} color="white" />}
</div>
<span className={`grid h-[18px] w-[18px] flex-none place-items-center rounded-full transition-colors ${isChecked ? 'bg-accent' : 'border-[1.5px] border-edge bg-surface-card'}`}>
{isChecked && <Check size={11} strokeWidth={3} className="text-accent-text" />}
</span>
)}
<PlaceAvatar place={place} category={cat} size={34} />
<div style={{ flex: 1, minWidth: 0 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 5, overflow: 'hidden' }}>
<div className="min-w-0 flex-1">
<div className="flex min-w-0 items-center gap-1.5">
{/* A stroke of the colour the track is drawn in — the map has no legend
of its own, so this is what tells you which line is this row (#776).
A line rather than another 11px icon, so it doesn't read as a second
category glyph next to the one below. */}
A line rather than another icon, so it doesn't read as a second
category glyph next to the one beside it. */}
{hasGeometry && (
<span title={t('places.trackIndicator')} style={{ display: 'inline-flex', flexShrink: 0 }}>
<span style={{ display: 'block', width: 14, height: 3, borderRadius: 999, background: resolveTrackColor(place) }} />
</span>
<Tooltip label={t('places.trackIndicator')}>
<span role="img" aria-label={t('places.trackIndicator')} className="inline-flex flex-none">
<span className="block" style={{ width: 14, height: 3, borderRadius: 999, background: resolveTrackColor(place) }} />
</span>
</Tooltip>
)}
{cat && (() => {
const CatIcon = getCategoryIcon(cat.icon)
return <span title={cat.name} style={{ display: 'inline-flex', flexShrink: 0 }}><CatIcon size={11} strokeWidth={2} color={cat.color || '#6366f1'} /></span>
})()}
<span className="text-content" style={{ fontSize: 'calc(13px * var(--fs-scale-body, 1))', fontWeight: 500, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', lineHeight: 1.2 }}>
{cat && CatIcon && (
<Tooltip label={cat.name}>
<span role="img" aria-label={cat.name} className="inline-flex flex-none">
<CatIcon size={12} strokeWidth={2.2} style={{ color: cat.color || 'var(--text-muted)' }} />
</span>
</Tooltip>
)}
<span id={nameId} className="min-w-0 truncate font-semibold leading-tight text-content" style={fs(13, 'body')}>
{place.name}
</span>
{/* Average member rating (#1435). */}
{(place.rating_count ?? 0) > 0 && place.rating_avg != null && (
<span style={{ display: 'inline-flex', alignItems: 'center', gap: 2, flexShrink: 0, fontSize: 'calc(10px * var(--fs-scale-caption, 1))', fontWeight: 600, color: 'var(--text-secondary)', fontVariantNumeric: 'tabular-nums' }}>
<Star size={9} color="#facc15" fill="#facc15" />
{(Math.round(place.rating_avg * 10) / 10).toLocaleString()}
</span>
{hasRating && (
<SoftPill className="tabular-nums" icon={<Star size={9} strokeWidth={2.2} fill="currentColor" className="flex-none text-warning" />}>
{(Math.round(place.rating_avg! * 10) / 10).toLocaleString()}
</SoftPill>
)}
</div>
{(place.description || place.address || cat?.name) && (
<div style={{ marginTop: 2 }}>
{/* Rendered, like the same line in the day plan: the description is
Markdown everywhere else, and printing it raw here was the one
place a formatted place read as `_underscores_`. Still clamped to
one line — the row is a list entry, not the inspector. */}
<div className="collab-note-md text-content-faint" style={{ fontSize: 'calc(11px * var(--fs-scale-caption, 1))', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', lineHeight: 1.2, maxHeight: '1.2em' }}>
<Markdown remarkPlugins={[remarkGfm]}>{place.description || place.address || cat?.name || ''}</Markdown>
</div>
{subline && (
// Rendered, like the same line in the day plan: the description is
// Markdown everywhere else, and printing it raw here was the one
// place a formatted place read as `_underscores_`. Still clamped to
// one line — the row is a list entry, not the inspector.
<div className="collab-note-md mt-0.5 overflow-hidden text-ellipsis whitespace-nowrap text-content-faint" style={{ ...fs(11), lineHeight: 1.2, maxHeight: '1.2em' }}>
<Markdown remarkPlugins={[remarkGfm]}>{subline}</Markdown>
</div>
)}
</div>
<div style={{ flexShrink: 0, display: 'flex', alignItems: 'center' }}>
{!selectMode && !inDay && selectedDayId !== null && (
<button type="button"
onClick={e => { e.stopPropagation(); onAssignToDay(place.id) }}
className="bg-surface-hover text-content-faint"
style={{
display: 'flex', alignItems: 'center', justifyContent: 'center',
width: 20, height: 20, borderRadius: 6,
border: 'none', cursor: 'pointer',
padding: 0, transition: 'background 0.15s, color 0.15s',
}}
onMouseEnter={e => { e.currentTarget.style.background = 'var(--accent)'; e.currentTarget.style.color = 'var(--accent-text)' }}
onMouseLeave={e => { e.currentTarget.style.background = 'var(--bg-hover)'; e.currentTarget.style.color = 'var(--text-faint)' }}
><Plus size={12} strokeWidth={2.5} /></button>
)}
</div>
{(showAddToDay || showMore) && (
// The row selects on click; the buttons and the menu they open act on their own.
<div role="presentation" className="flex flex-none items-center gap-0.5" onClick={e => e.stopPropagation()}>
{showAddToDay && (
<Tooltip label={t('planner.addToDay')}>
<button type="button"
onClick={() => onAssignToDay(place.id)}
aria-label={t('planner.addToDay')}
className="grid h-[26px] w-[26px] place-items-center rounded-full bg-surface-card text-content-muted shadow-sm ring-1 ring-edge-faint transition-colors hover:bg-accent hover:text-accent-text hover:ring-transparent"
>
<Plus size={13} strokeWidth={2.4} />
</button>
</Tooltip>
)}
{showMore && <MoreButton label={t('files.menu')} items={menuItems(place, selectedDayId)} />}
</div>
)}
</div>
)
})