Flip a single holiday to a working day by clicking it

The status on the right of each public holiday is now a button. Clicking
it writes an override for that one date, and clicking it back removes the
override rather than storing a row that agrees with the almanac. Because
an override is keyed on an absolute date, the same holiday in other years
is left alone — which is what was asked for and needed no schema change.

The separate badge saying an override exists stays, so the fact that a
day has been changed is not carried by the button alone.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ei7gCZzdd751uZtPzb1Pep
This commit is contained in:
2026-09-19 14:38:45 +02:00
parent b87ad0e7ad
commit 663d5fcd92
7 changed files with 277 additions and 7 deletions
+33
View File
@@ -839,5 +839,38 @@ describe('Settings', () => {
expect(hooks.useCalendarDays).toHaveBeenLastCalledWith('ws-1', CURRENT_YEAR - 4, 4)
})
it('wires the toggle button through to the shared day-overrides hook', async () => {
vi.mocked(hooks.useCalendarDays).mockReturnValue(
makeCalendarDaysResult({
data: {
...mockCalendarWindow,
days: [
{
date: `${CURRENT_YEAR}-01-01`,
name: 'Nyårsdagen',
dayType: 'red_day',
isOverride: false,
overrideIsWorkingDay: null,
isFree: true,
},
],
},
})
)
renderSettings()
fireEvent.click(screen.getByTestId(`red-days-toggle-${CURRENT_YEAR}-01-01`))
await waitFor(() => {
expect(mockUpsertDayOverride).toHaveBeenCalledWith({
workspaceId: 'ws-1',
date: `${CURRENT_YEAR}-01-01`,
isWorkingDay: true,
note: null,
})
})
})
})
})