feat(oxibadge): add timesheet review and export screen
Check, format and test / build (push) Successful in 10m16s

Add the month-review screen shown after records/employees load: an
editable per-employee timesheet table with issue/rounding detection,
bulk fixes (reorder stacked punches, add lunch break, round to step),
and an export flow (single employee or all) wired to a new Rust
export_timesheet command. Split into focused components under
review/ instead of one large file, with shared i18n keys and a new
export_timesheet IPC command.

Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 15:56:25 +02:00
parent b4cd8e1796
commit acd3efeac6
19 changed files with 2664 additions and 36 deletions
@@ -0,0 +1,215 @@
<script lang="ts">
import { _ } from 'svelte-i18n';
import { ROUND_STEP } from './analysis';
import FixButton from './FixButton.svelte';
import ActionButton from './ActionButton.svelte';
let {
title,
scopeIssues,
scopeInfos,
items,
onclose,
onroundandexport,
onexportanyway
}: {
title: string;
scopeIssues: number;
scopeInfos: number;
items: { key: string; label: string; detail: string; red: boolean; go: () => void }[];
onclose: () => void;
onroundandexport: () => void;
onexportanyway: () => void;
} = $props();
</script>
<div class="modal-wrap">
<button type="button" class="modal-backdrop" aria-label={$_('review.cancel_export_aria')} onclick={onclose}
></button>
<div class="modal" role="alertdialog" aria-modal="true" aria-labelledby="ox-exp-title" aria-describedby="ox-exp-desc">
<div class="modal-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
>
</div>
<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: ROUND_STEP } })}
{/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>
</div>
</div>
<style>
.modal-wrap {
position: absolute;
inset: 0;
z-index: 40;
display: flex;
align-items: center;
justify-content: center;
padding: 24px;
box-sizing: border-box;
}
.modal-backdrop {
all: unset;
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.6);
cursor: default;
}
.modal {
position: relative;
width: 100%;
max-width: 440px;
box-sizing: border-box;
padding: 24px;
background: #1a1a1a;
border: 1px solid #333333;
border-radius: 18px;
box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
display: flex;
flex-direction: column;
gap: 18px;
}
.modal-icon {
width: 44px;
height: 44px;
border-radius: 12px;
background: rgba(229, 72, 77, 0.14);
color: #ff6b74;
display: flex;
align-items: center;
justify-content: center;
}
.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>