From 731df2e0621b9220e80519ac9dfc25875cb0d18d Mon Sep 17 00:00:00 2001 From: work Date: Sat, 11 May 2024 23:35:34 +0200 Subject: [PATCH] fix small problems --- .../to-dos-panel/ToDosPanel.svelte | 2 +- .../to-dos-panel/to-do-list/ToDoList.svelte | 21 ++++++++++++------- src/lib/components/modal/Modal.svelte | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/lib/components/calendar/calendar-body/calendar-columns/calendar-rows/to-dos-panel/ToDosPanel.svelte b/src/lib/components/calendar/calendar-body/calendar-columns/calendar-rows/to-dos-panel/ToDosPanel.svelte index 4971958b..a0f23555 100644 --- a/src/lib/components/calendar/calendar-body/calendar-columns/calendar-rows/to-dos-panel/ToDosPanel.svelte +++ b/src/lib/components/calendar/calendar-body/calendar-columns/calendar-rows/to-dos-panel/ToDosPanel.svelte @@ -35,5 +35,5 @@ (isOpen = false)} show={isOpen}> - + (isOpen = false)} on:editTask on:persistToDos {toDos} /> diff --git a/src/lib/components/calendar/calendar-body/calendar-columns/calendar-rows/to-dos-panel/to-do-list/ToDoList.svelte b/src/lib/components/calendar/calendar-body/calendar-columns/calendar-rows/to-dos-panel/to-do-list/ToDoList.svelte index 2c18174c..4bbd51b9 100644 --- a/src/lib/components/calendar/calendar-body/calendar-columns/calendar-rows/to-dos-panel/to-do-list/ToDoList.svelte +++ b/src/lib/components/calendar/calendar-body/calendar-columns/calendar-rows/to-dos-panel/to-do-list/ToDoList.svelte @@ -13,6 +13,7 @@ export let toDos: ToDo[]; const dispatch = createEventDispatcher<{ + close: null; editTask: { targetDate: string; task: AnyTask }; persistToDos: ToDo[]; }>(); @@ -21,6 +22,12 @@ $: totalDuration = getTotalDuration(uncompletedToDos); + $: { + if (toDos.length === 0) { + dispatch('close'); + } + } + function postponeToDos() { const postponedToDos = uncompletedToDos.map((toDo) => ({ ...toDo, @@ -31,7 +38,7 @@ } -
+

To Dos

@@ -48,13 +55,11 @@ class="flex cursor-pointer justify-between gap-3 px-6 py-3 hover:bg-gray-100 hover:underline" on:click={() => dispatch('editTask', { targetDate: '', task: toDo })} > -
- -
- {toDo.name} -
+ +
+ {toDo.name}
{getDuration(toDo)} diff --git a/src/lib/components/modal/Modal.svelte b/src/lib/components/modal/Modal.svelte index 43238dfa..dc95886f 100644 --- a/src/lib/components/modal/Modal.svelte +++ b/src/lib/components/modal/Modal.svelte @@ -13,7 +13,7 @@
dispatch('close')} /> -
+