mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 13:23:04 +00:00
0dd07befa7
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.
43 lines
1.9 KiB
TypeScript
43 lines
1.9 KiB
TypeScript
import { useTranslation } from '../../../i18n'
|
|
import { Tooltip } from '../../shared/Tooltip'
|
|
import { DialogHeader, PILL, type DialogHeaderProps } from '../../shared/DialogShell'
|
|
import { typeInfo } from './bookingsModel'
|
|
import { TypeTile, toneColor, toneTint, type StatusTone } from './bookingParts'
|
|
|
|
export interface BookingDialogHeaderProps extends Omit<DialogHeaderProps, 'tile' | 'tint'> {
|
|
tone: StatusTone
|
|
/** The booking type, drawn as the raised tile on the left. */
|
|
type: string
|
|
}
|
|
|
|
/** The head band of a booking dialog, tinted by the status like the card the booking sits on. */
|
|
export function BookingDialogHeader({ tone, type, ...rest }: BookingDialogHeaderProps) {
|
|
return <DialogHeader {...rest} tile={<TypeTile type={type} size={46} raised />} tint={toneTint(tone)} />
|
|
}
|
|
|
|
/** Confirmed or pending with its dot. With onToggle it switches to the other. */
|
|
export function StatusPill({ status, onToggle }: { status: 'confirmed' | 'pending'; onToggle?: () => void }) {
|
|
const { t } = useTranslation()
|
|
const content = (
|
|
<>
|
|
<span className="h-2 w-2 flex-none rounded-full" style={{ background: toneColor(status) }} />
|
|
{status === 'confirmed' ? t('reservations.confirmed') : t('reservations.pending')}
|
|
</>
|
|
)
|
|
if (!onToggle) return <span className={PILL}>{content}</span>
|
|
const label = t('reservations.status.switchTo', { status: status === 'confirmed' ? t('reservations.pending') : t('reservations.confirmed') })
|
|
return (
|
|
<Tooltip label={label}>
|
|
<button type="button" onClick={onToggle} aria-label={label} className={`${PILL} hover:opacity-80`}>
|
|
{content}
|
|
</button>
|
|
</Tooltip>
|
|
)
|
|
}
|
|
|
|
export function TypePill({ type }: { type: string }) {
|
|
const { t } = useTranslation()
|
|
const info = typeInfo(type)
|
|
return <span className={PILL}><info.Icon size={13} strokeWidth={2.2} style={{ color: info.color }} />{t(info.chipKey)}</span>
|
|
}
|