mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 09:54:14 +00:00
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:
@@ -1,4 +1,4 @@
|
||||
import React, { useMemo } from 'react'
|
||||
import React, { useId, useMemo } from 'react'
|
||||
import CustomSelect from '../shared/CustomSelect'
|
||||
import { useTranslation } from '../../i18n/TranslationContext'
|
||||
import { useSettingsStore } from '../../store/settingsStore'
|
||||
@@ -33,12 +33,14 @@ const ROW = 'flex flex-wrap gap-1.5'
|
||||
/**
|
||||
* What holds the pieces of one option apart.
|
||||
*
|
||||
* A separator rather than a sentence, and deliberately not a word: the caption above
|
||||
* already says these are the stretches to add between, so a row only has to name the two
|
||||
* stops and how far off them the place lies. It also reads the same way in a language
|
||||
* written right to left, which an arrow would not.
|
||||
* Space rather than a sentence, and deliberately not a word or a glyph: the caption
|
||||
* above already says these are the stretches to add between, so a row only has to name
|
||||
* the two stops and how far off them the place lies. It also reads the same way in a
|
||||
* language written right to left, which an arrow would not. An em space, because an
|
||||
* option label is plain text and a single space would run a stop's name into the next
|
||||
* one's.
|
||||
*/
|
||||
const SEP = ' · '
|
||||
const GAP = ' '
|
||||
|
||||
interface ServiceStopSectionProps {
|
||||
mode: ServiceStopMode
|
||||
@@ -62,6 +64,9 @@ export default function ServiceStopSection({
|
||||
const { t } = useTranslation()
|
||||
const distanceUnit = useSettingsStore(s => s.settings.distance_unit)
|
||||
const choice = useMemo(() => serviceStopChoice(mode, lat, lng, leg), [mode, lat, lng, leg])
|
||||
const kindId = useId()
|
||||
const stayId = useId()
|
||||
const legId = useId()
|
||||
|
||||
/**
|
||||
* The stretches on offer, each naming what it is and how far the place lies from it.
|
||||
@@ -73,11 +78,11 @@ export default function ServiceStopSection({
|
||||
const options = useMemo(() => [
|
||||
...choice.legs.map(item => ({
|
||||
value: item.value,
|
||||
label: item.offRouteKm === null
|
||||
? `${item.from}${SEP}${item.to}`
|
||||
: `${item.from}${SEP}${item.to}${SEP}${t('roadtrip.poi.offRoute', {
|
||||
distance: formatDistance(item.offRouteKm, distanceUnit),
|
||||
})}`,
|
||||
label: [
|
||||
item.from,
|
||||
item.to,
|
||||
item.offRouteKm === null ? null : t('roadtrip.poi.offRoute', { distance: formatDistance(item.offRouteKm, distanceUnit) }),
|
||||
].filter(Boolean).join(GAP),
|
||||
badge: t('roadtrip.day', { number: item.dayNumber }),
|
||||
})),
|
||||
...(choice.end
|
||||
@@ -93,17 +98,19 @@ export default function ServiceStopSection({
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<div>
|
||||
<label className={LABEL}>{t('roadtrip.stop.kind')}</label>
|
||||
<label id={kindId} className={LABEL}>{t('roadtrip.stop.kind')}</label>
|
||||
<StopKindChips
|
||||
value={stopType}
|
||||
onPick={(kind, wasChosen) => { if (!wasChosen) onStopType(kind) }}
|
||||
className={ROW}
|
||||
labelledBy={kindId}
|
||||
white
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className={LABEL}>{t('roadtrip.stop.stay')}</label>
|
||||
<StopStayChips value={minutes} onPick={onMinutes} className={ROW} />
|
||||
<label id={stayId} className={LABEL}>{t('roadtrip.stop.stay')}</label>
|
||||
<StopStayChips value={minutes} onPick={onMinutes} className={ROW} labelledBy={stayId} white />
|
||||
</div>
|
||||
|
||||
{/* Where it goes. Preselected from the projection, and changeable.
|
||||
@@ -115,8 +122,11 @@ export default function ServiceStopSection({
|
||||
{t('roadtrip.poi.manualNoCoords')}
|
||||
</p>
|
||||
) : choice.legs.length > 0 ? (
|
||||
<div>
|
||||
<label className={LABEL}>{t('roadtrip.poi.addBetween')}</label>
|
||||
// A group named by the caption rather than a label pointing at the trigger: a
|
||||
// label would replace the trigger's name, which is the stretch chosen, and a
|
||||
// click on it would open the menu.
|
||||
<div role="group" aria-labelledby={legId}>
|
||||
<label id={legId} className={LABEL}>{t('roadtrip.poi.addBetween')}</label>
|
||||
<CustomSelect
|
||||
value={choice.legValue}
|
||||
onChange={value => onLeg(String(value))}
|
||||
|
||||
Reference in New Issue
Block a user