diff --git a/apps/tauri/src-tauri/tauri.conf.json b/apps/tauri/src-tauri/tauri.conf.json index ad02de7..0028a1b 100644 --- a/apps/tauri/src-tauri/tauri.conf.json +++ b/apps/tauri/src-tauri/tauri.conf.json @@ -20,7 +20,7 @@ "minHeight": 500, "resizable": true, "decorations": false, - "transparent": true + "transparent": false } ], "security": { diff --git a/apps/tauri/src/App.svelte b/apps/tauri/src/App.svelte index ecc3e47..7e9641f 100644 --- a/apps/tauri/src/App.svelte +++ b/apps/tauri/src/App.svelte @@ -11,10 +11,10 @@
-
+
{#if app.error}
import { app } from "../stores/app.svelte"; + import DateTimePicker from "./DateTimePicker.svelte"; let title = $state(""); let description = $state(""); + let dueDate = $state(null); let inputEl = $state(null); + let showDatePicker = $state(false); async function handleSubmit() { if (!title.trim()) return; await app.createTask(title.trim(), description.trim() || undefined); + if (dueDate && app.tasks.length > 0) { + const created = app.tasks[app.tasks.length - 1]; + await app.updateTask({ ...created, due_date: dueDate, updated_at: new Date().toISOString() }); + } title = ""; description = ""; + dueDate = null; newTaskState.open = false; } @@ -22,6 +30,24 @@ newTaskState.open = false; title = ""; description = ""; + dueDate = null; + showDatePicker = false; + } + + function handleDateChange(iso: string | null) { + dueDate = iso; + } + + function formatDateChip(iso: string): string { + const d = new Date(iso); + const today = new Date(); + const dayNames = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; + const day = dayNames[d.getDay()]; + const pad = (n: number) => String(n).padStart(2, "0"); + const hasTime = d.getHours() !== 0 || d.getMinutes() !== 0; + const timePart = hasTime ? `, ${pad(d.getHours())}:${pad(d.getMinutes())}` : ""; + if (d.toDateString() === today.toDateString()) return `Today${timePart}`; + return `${day}, ${pad(d.getDate())}/${pad(d.getMonth() + 1)}${timePart}`; } $effect(() => { @@ -31,51 +57,90 @@ }); - +
{ if (e.key === "Escape") handleClose(); }} ->
- - -
-
-
{ e.preventDefault(); handleSubmit(); }}> - { if (e.key === "Escape") handleClose(); }} - /> - +
e.stopPropagation()} +> + { e.preventDefault(); handleSubmit(); }} class="px-4 pt-4"> + + { if (e.key === "Escape") handleClose(); }} + /> + + +
+ + + +
+ + +
+ + + + {#if dueDate} +
+ + +
+ {:else} + + {/if} +
+ + + +
+
+ + + {#if showDatePicker} + (showDatePicker = false)} + /> + {/if} +
diff --git a/apps/tauri/src/lib/screens/TasksScreen.svelte b/apps/tauri/src/lib/screens/TasksScreen.svelte index 41bfb3e..8bf756e 100644 --- a/apps/tauri/src/lib/screens/TasksScreen.svelte +++ b/apps/tauri/src/lib/screens/TasksScreen.svelte @@ -334,7 +334,6 @@
{ if (isDesktop) appWindow.toggleMaximize(); }} class="relative flex items-center border-b border-border-light px-4 py-3 dark:border-border-dark" > @@ -367,14 +366,6 @@ - {/if}