feat(oxibadge): warn before losing unexported review edits, add undo
Check, format and test / build (push) Successful in 10m25s

The review screen now tracks whether there are edits not yet exported
and asks for confirmation before discarding them: clicking back, or
closing the app window entirely (intercepted via onCloseRequested,
which needed a core:window:allow-destroy capability that wasn't
granted by core:default). The confirmation dialog (ConfirmDialog.svelte)
is generic, built on a shared ModalFrame extracted from ExportModal so
the two don't duplicate the backdrop/box styling.

Also adds undo: a per-row button (icon-only, left of the note, shown
when that day has edits) reverts just that day instantly, and a
per-employee "undo all" (icon in a red box, last among the header's
tools) reverts every day for the current employee after a confirmation
dialog, since that one can't be undone itself.

ActionButton moves out of review/ next to IconButton/PillButton, since
ConfirmDialog (outside the review feature) now uses it too.

Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 13:46:31 +02:00
parent 25127bee96
commit 0c320c39b0
13 changed files with 421 additions and 104 deletions
@@ -12,7 +12,8 @@
oncellinput,
onfixday,
onaddlunch,
onroundday
onroundday,
onundoday
}: {
rows: Row[];
rounded: Record<string, string>;
@@ -22,6 +23,7 @@
onfixday: (di: number) => void;
onaddlunch: (di: number) => void;
onroundday: (di: number) => void;
onundoday: (di: number) => void;
} = $props();
</script>
@@ -85,6 +87,19 @@
<td class="note {note.kind}">
<span class="note-in">
{#if r.rowEdits > 0}
<button
type="button"
class="undo-btn"
aria-label={$_('review.undo_day_aria', { values: { label } })}
title={$_('review.undo_short')}
onclick={() => onundoday(r.di)}
>
<svg width="14" height="14" viewBox="0 0 24 24" aria-hidden="true" style="stroke-width: 2"
><path d="M9 14l-5-5 5-5" /><path d="M20 20v-7a4 4 0 0 0-4-4H4" /></svg
>
</button>
{/if}
{#if note.kind === 'issue'}
<svg width="14" height="14" viewBox="0 0 24 24" aria-hidden="true"
><circle cx="12" cy="12" r="9" /><path d="M12 7.5v5.5M12 16.5h.01" /></svg
@@ -377,6 +392,33 @@
gap: 8px;
}
.undo-btn {
all: unset;
box-sizing: border-box;
width: 22px;
height: 22px;
flex: none;
display: flex;
align-items: center;
justify-content: center;
border-radius: 6px;
color: #6e6e6e;
cursor: pointer;
transition:
background 0.15s,
color 0.15s;
}
.undo-btn:hover {
background: #262626;
color: #e6e6e6;
}
.undo-btn:focus-visible {
outline: 2px solid var(--ox-accent);
outline-offset: 1px;
}
.empty {
padding: 48px 24px;
display: flex;