Refactor duplicate code, lints, correct engine status render

This commit is contained in:
2026-03-14 20:18:51 +02:00
parent 756c1cdc47
commit d7fd717c95
8 changed files with 52 additions and 66 deletions

View File

@@ -72,7 +72,7 @@
{#if rota.metrics.length > 0}
<div class="h-px w-full bg-zinc-200"></div>
<div class="flex flex-1 flex-col py-4">
<div class="flex flex-col py-4">
<p class="px-6 pb-2 text-[10px] font-black tracking-widest text-zinc-400 uppercase">
Δικαιωσυνη
</p>
@@ -169,7 +169,7 @@
</div>
{/if}
<div class="h-px w-full bg-zinc-200"></div>
<div class="mt-auto h-px w-full bg-zinc-200"></div>
<div class="space-y-4 p-4">
<div
class="border-l-2 py-2 pl-3 transition-colors

View File

@@ -12,10 +12,10 @@
{ value: 6, label: "Ιούνιος" },
{ value: 7, label: "Ιούλιος" },
{ value: 8, label: "Αύγουστος" },
{ value: 9, label: "Σεπτέμβιος" },
{ value: 9, label: "Σεπτέμβριος" },
{ value: 10, label: "Οκτώβριος" },
{ value: 11, label: "Νοέμβριος" },
{ value: 12, label: "Δεκέμβιος" }
{ value: 12, label: "Δεκέμβριος" }
];
const yearOptions = [2026, 2027];
@@ -44,7 +44,6 @@
<div class="relative">
<select
bind:value={rota.selectedMonth}
onchange={() => rota.syncProjectMonth()}
class="w-full appearance-none rounded-xl border border-zinc-200 bg-white px-4 py-3 font-semibold text-zinc-700 transition-all outline-none focus:border-zinc-400 focus:ring-4 focus:ring-zinc-100"
>
{#each monthOptions as month}
@@ -72,7 +71,6 @@
<div class="relative">
<select
bind:value={rota.selectedYear}
onchange={() => rota.syncProjectMonth()}
class="w-full appearance-none rounded-xl border border-zinc-200 bg-white px-4 py-3 font-semibold text-zinc-700 transition-all outline-none focus:border-zinc-400 focus:ring-4 focus:ring-zinc-100"
>
{#each yearOptions as year}

View File

@@ -50,6 +50,7 @@
let config = rota.toDTO();
rota.engineStatus = EngineStatus.Running;
rota.lastMessage = "";
await new Promise((resolve) => setTimeout(resolve, 50));
try {
rota.solution = await invoke<MonthlyScheduleDTO>("generate", { config });

View File

@@ -39,13 +39,9 @@ export class RotaState {
metrics: ResidentMetrics[] = $state([]);
projectMonth = $state(new CalendarDate(2026, 2, 1));
syncProjectMonth() {
this.projectMonth = new CalendarDate(this.selectedYear, this.selectedMonth, 1);
}
projectMonth = $derived(new CalendarDate(this.selectedYear, this.selectedMonth, 1));
projectMonthDays = $derived(this.projectMonth.calendar.getDaysInMonth(this.projectMonth));
daysArray = $derived(Array.from({ length: this.projectMonthDays }, (_, i) => i + 1));
emptySlots = $derived(Array.from({ length: getDayOfWeek(this.projectMonth, "en-GB") }));