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>
175 lines
4.1 KiB
Svelte
175 lines
4.1 KiB
Svelte
<script lang="ts">
|
|
import { _ } from 'svelte-i18n';
|
|
import type { Shifts } from '$lib/shifts';
|
|
import ModalFrame from '../ModalFrame.svelte';
|
|
import FixButton from './FixButton.svelte';
|
|
import ActionButton from '../ActionButton.svelte';
|
|
|
|
let {
|
|
title,
|
|
scopeIssues,
|
|
scopeInfos,
|
|
shift,
|
|
items,
|
|
onclose,
|
|
onroundandexport,
|
|
onexportanyway
|
|
}: {
|
|
title: string;
|
|
scopeIssues: number;
|
|
scopeInfos: number;
|
|
shift: Shifts;
|
|
items: { key: string; label: string; detail: string; red: boolean; go: () => void }[];
|
|
onclose: () => void;
|
|
onroundandexport: () => void;
|
|
onexportanyway: () => void;
|
|
} = $props();
|
|
</script>
|
|
|
|
<ModalFrame
|
|
titleId="ox-exp-title"
|
|
descId="ox-exp-desc"
|
|
closeAriaLabel={$_('review.cancel_export_aria')}
|
|
{onclose}
|
|
>
|
|
{#snippet icon()}
|
|
<svg width="22" height="22" viewBox="0 0 24 24" aria-hidden="true"
|
|
><path d="M10.3 3.9L2.4 17.5A2 2 0 0 0 4.1 20.5h15.8a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z" /><path
|
|
d="M12 9.5v4M12 17h.01"
|
|
/></svg
|
|
>
|
|
{/snippet}
|
|
<div class="modal-text">
|
|
<h2 id="ox-exp-title">{title}</h2>
|
|
<p id="ox-exp-desc">
|
|
{#if scopeIssues}
|
|
{$_('review.export_warning_issues')}
|
|
{:else}
|
|
{$_('review.export_warning_unrounded', { values: { step: shift.round_step_min } })}
|
|
{/if}
|
|
</p>
|
|
</div>
|
|
<div class="modal-list scroll">
|
|
{#each items as it (it.key)}
|
|
<button type="button" class="menu-item row-item" onclick={it.go}>
|
|
<span class="mi-label">{it.label}</span>
|
|
<span class="mi-detail" class:red={it.red} class:blue={!it.red}>{it.detail}</span>
|
|
<svg width="14" height="14" viewBox="0 0 24 24" aria-hidden="true" class="mi-chev"
|
|
><path d="M9 6l6 6-6 6" /></svg
|
|
>
|
|
</button>
|
|
{/each}
|
|
</div>
|
|
<div class="modal-actions">
|
|
<ActionButton onclick={onclose}>{$_('review.back_to_review')}</ActionButton>
|
|
{#if scopeIssues === 0 && scopeInfos > 0}
|
|
<FixButton size="tall" blue onclick={onroundandexport}>
|
|
{#snippet icon()}
|
|
<svg width="16" height="16" viewBox="0 0 24 24" aria-hidden="true" style="stroke-width: 2"
|
|
><circle cx="12" cy="13" r="8" /><path d="M12 9v4l2.5 2.5M10 2h4" /></svg
|
|
>
|
|
{/snippet}
|
|
{$_('review.round_and_export')}
|
|
</FixButton>
|
|
{/if}
|
|
<ActionButton primary onclick={onexportanyway}>
|
|
{#snippet icon()}
|
|
<svg width="18" height="18" viewBox="0 0 24 24" aria-hidden="true" style="stroke-width: 2"
|
|
><path d="M12 4v11M7 10l5 5 5-5M5 20h14" /></svg
|
|
>
|
|
{/snippet}
|
|
{$_('review.export_anyway')}
|
|
</ActionButton>
|
|
</div>
|
|
</ModalFrame>
|
|
|
|
<style>
|
|
.modal-text {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 8px;
|
|
}
|
|
|
|
.modal-text h2 {
|
|
margin: 0;
|
|
font-family: var(--ox-font-display);
|
|
font-weight: 700;
|
|
font-size: 22px;
|
|
line-height: 1.2;
|
|
letter-spacing: -0.02em;
|
|
color: #ffffff;
|
|
}
|
|
|
|
.modal-text p {
|
|
margin: 0;
|
|
font-size: 14px;
|
|
line-height: 1.5;
|
|
color: #a3a3a3;
|
|
}
|
|
|
|
.modal-list {
|
|
max-height: 196px;
|
|
overflow-y: auto;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 2px;
|
|
padding: 4px;
|
|
border: 1px solid #2a2a2a;
|
|
border-radius: 12px;
|
|
background: #151515;
|
|
}
|
|
|
|
.menu-item {
|
|
all: unset;
|
|
box-sizing: border-box;
|
|
width: 100%;
|
|
display: flex;
|
|
align-items: flex-start;
|
|
gap: 12px;
|
|
padding: 10px 12px;
|
|
border-radius: 10px;
|
|
font-size: 14px;
|
|
color: #bdbdbd;
|
|
cursor: pointer;
|
|
transition: background 0.15s;
|
|
}
|
|
|
|
.menu-item:hover {
|
|
background: #252525;
|
|
}
|
|
|
|
.menu-item:focus-visible {
|
|
outline: 2px solid var(--ox-accent);
|
|
outline-offset: -2px;
|
|
}
|
|
|
|
.row-item {
|
|
align-items: center;
|
|
padding: 8px 10px;
|
|
min-height: 40px;
|
|
}
|
|
|
|
.mi-label {
|
|
flex: 1;
|
|
min-width: 0;
|
|
color: #e6e6e6;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.mi-detail {
|
|
font-size: 12.5px;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.mi-chev {
|
|
color: #6e6e6e;
|
|
}
|
|
|
|
.modal-actions {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
justify-content: flex-end;
|
|
gap: 10px;
|
|
}
|
|
</style>
|