mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-29 08:00:06 +00:00
feat(dayplan): a day can be deleted from the reorder dialog, after a warning that says what goes with it
Every row of the reorder dialog, and of the days sheet on a phone, now has a delete button. It first asks, and the question lists what goes with the day: planned places stay in the place list, notes and day texts are deleted, bookings stay without a day, a stay that checks in or out on the day is cancelled with its booking and expense (shown in the danger tone), and on a dated trip the later days and their bookings move one date earlier or the trip ends a day earlier. The server side moved from a bare DELETE into DayRemovalService, which REST, the delete_day tool and the plugin RPC all use. It closes the numbering, keeps the dates on their positions like a reorder, re-stamps the moved bookings, shifts the road trip boundaries, cancels touching stays through the accommodations domain, refuses the last day of a trip, and fans out day:deleted, day:reordered and trip:updated so collaborators renumber and see the new day count and end date. The trip query moved into a leaf file so the days domain can read it without a module cycle. On the client the delete is online only, runs optimistically through the days slice with the same reducer collaborators apply, and the ConfirmDialog gained a slot for extra content, an Escape that only closes itself, and the danger and accent tokens.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import DayImpactList, { type ImpactListSkin } from '../../components/shared/DayImpactList'
|
||||
import type { ImpactLine } from '../../utils/dayImpactLines'
|
||||
|
||||
/** The mobile tokens for the same rows: an inset card with hairlines between rows. */
|
||||
const PHONE: ImpactListSkin = {
|
||||
list: 'mt-3 overflow-hidden rounded-[13px] border border-[color:var(--m-inbr)] bg-[color:var(--m-inner)]',
|
||||
row: 'flex items-start gap-[10px] px-[11px] py-[9px]',
|
||||
divider: 'border-t border-[color:var(--m-rowbr)]',
|
||||
chip: 'mt-[1px] flex h-[26px] w-[26px] flex-none items-center justify-center rounded-full',
|
||||
iconSize: 13,
|
||||
text: 'text-[0.78125rem] font-semibold leading-snug',
|
||||
hint: 'mt-[2px] text-[0.6875rem] leading-snug text-m-muted',
|
||||
chipTone: {
|
||||
neutral: 'bg-[color:var(--m-ic)] text-m-muted',
|
||||
muted: 'bg-[color:var(--m-ic)] text-m-faint',
|
||||
warning: 'bg-[color:color-mix(in_srgb,var(--m-st-pending)_14%,transparent)] text-[color:var(--m-st-pending)]',
|
||||
danger: 'bg-[color:color-mix(in_srgb,var(--m-st-danger)_12%,transparent)] text-[color:var(--m-st-danger)]',
|
||||
},
|
||||
textTone: {
|
||||
neutral: 'text-m-ink',
|
||||
muted: 'text-m-muted',
|
||||
warning: 'text-m-ink',
|
||||
danger: 'text-[color:var(--m-st-danger)]',
|
||||
},
|
||||
}
|
||||
|
||||
/** The phone's day impact list: DayImpactList drawn in the mobile tokens. */
|
||||
export default function MDayImpactList({ lines, label }: { lines: ImpactLine[]; label?: string }) {
|
||||
return <DayImpactList lines={lines} label={label} skin={PHONE} />
|
||||
}
|
||||
Reference in New Issue
Block a user