Let a day removed from a period stay removed
Taking one day out of a period the planner placed did nothing that lasted: the period still asked for a full week, so the next sync put the day straight back. The option was disabled rather than lying about it. A removed day is now recorded as its own thing — no leave for this parent, this child, this date — and the planner honours it on every later sync. It is kept apart from the working-day overrides, which answer a different question about the calendar rather than about the plan. The day belongs to the parent whose band was clicked, so removing one parent's day leaves their partner's alone; where both parents were to be off on one funding arrangement, the partner is simply funded on their own instead. A removed day shortens what the period is asking for rather than counting as a day the plan failed to find, so the advice about closing a shortfall does not start arguing for a day nobody wants. Nothing is removed without a way back: the toast undoes it, and the day itself is marked in the calendar and offers to restore. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ei7gCZzdd751uZtPzb1Pep
This commit is contained in:
@@ -14,6 +14,11 @@ export interface BandClickInfo {
|
||||
parentPersonalDataUuid: string
|
||||
startDate: string
|
||||
endDate: string
|
||||
/** The single date the user actually clicked inside the band, which is what
|
||||
* the popover's "this day" removes. Clicking the band anywhere else (or
|
||||
* activating it from the keyboard) reports the band's own start date, so
|
||||
* this is never empty. */
|
||||
clickedDate: string
|
||||
}
|
||||
|
||||
export interface CalendarWeekProps {
|
||||
@@ -42,6 +47,11 @@ export interface CalendarWeekProps {
|
||||
onPointerEnter: (date: string) => void
|
||||
/** §3.4/§3.6 — calendar metadata (röda dagar/klämdagar/overrides) keyed by ISO date. */
|
||||
calendarDaysByDate?: Map<string, CalendarDayEntry> | undefined
|
||||
/** Dates the user has removed from the plan by hand (see
|
||||
* `PlannedDayExclusion`). A date the planner deliberately skipped inside an
|
||||
* otherwise-funded period is invisible otherwise, and the hole in the week
|
||||
* looks like a bug. */
|
||||
excludedDates?: Set<string> | undefined
|
||||
/** Opens the period editor for the clicked band's underlying period. */
|
||||
onBandClick?: ((info: BandClickInfo) => void) | undefined
|
||||
/** §Task7 — the wishId of a just-created/just-edited period to briefly
|
||||
@@ -283,6 +293,7 @@ export function CalendarWeek({
|
||||
onPointerDown,
|
||||
onPointerEnter,
|
||||
calendarDaysByDate,
|
||||
excludedDates,
|
||||
onBandClick,
|
||||
flashWishId,
|
||||
monthMaxLaneCount,
|
||||
@@ -352,6 +363,7 @@ export function CalendarWeek({
|
||||
holidayName={calendarInfo?.name ?? null}
|
||||
isOverride={calendarInfo?.isOverride ?? false}
|
||||
overrideIsWorkingDay={calendarInfo?.overrideIsWorkingDay ?? null}
|
||||
isExcluded={excludedDates?.has(date) ?? false}
|
||||
// Every cell is clickable/drag-selectable regardless of which
|
||||
// month it visually belongs to — `dayIsCurrentMonth` only
|
||||
// controls the dimmed `calendar-day--disabled` styling above.
|
||||
@@ -394,12 +406,15 @@ export function CalendarWeek({
|
||||
.filter(Boolean)
|
||||
.join(' ')
|
||||
|
||||
const fireClick = () =>
|
||||
const fireClick = (clickedDate?: string) =>
|
||||
onBandClick?.({
|
||||
wishId: segment.wishId,
|
||||
parentPersonalDataUuid: segment.parentUuid,
|
||||
startDate: segment.overallStart,
|
||||
endDate: segment.overallEnd,
|
||||
// Falls back to the band's first date when the click didn't land
|
||||
// on a specific day slot (the band's padding, or the keyboard).
|
||||
clickedDate: clickedDate ?? segment.overallStart,
|
||||
})
|
||||
|
||||
return (
|
||||
@@ -417,7 +432,7 @@ export function CalendarWeek({
|
||||
aria-label={`${label} · ${typeLabel}, ${segment.overallStart} – ${segment.overallEnd}`}
|
||||
role={onBandClick ? 'button' : undefined}
|
||||
tabIndex={onBandClick ? 0 : undefined}
|
||||
onClick={onBandClick ? fireClick : undefined}
|
||||
onClick={onBandClick ? () => fireClick() : undefined}
|
||||
onKeyDown={
|
||||
onBandClick
|
||||
? (e) => {
|
||||
@@ -443,6 +458,18 @@ export function CalendarWeek({
|
||||
style={info.isGap ? undefined : { backgroundColor: getColorForType(info.dayType ?? 'vacation') }}
|
||||
title={info.isPinned ? t('calendarDay.pinnedAria') : undefined}
|
||||
data-testid={info.isPinned ? 'calendar-band-day-pinned' : undefined}
|
||||
// Clicking one day slot opens the same popover as clicking
|
||||
// the band, but tells it WHICH date was clicked — "this
|
||||
// day" must be able to remove a day in the middle of a
|
||||
// period, not only its first.
|
||||
onClick={
|
||||
onBandClick
|
||||
? (e) => {
|
||||
e.stopPropagation()
|
||||
fireClick(info.date)
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user