From 8c998621031245946d82fdc2bb3ab1dd881c9230 Mon Sep 17 00:00:00 2001 From: exyi Date: Wed, 30 Sep 2020 22:00:57 +0000 Subject: [PATCH] Fix full close of TaskPanel --- frontend/src/TaskPanel.svelte | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/TaskPanel.svelte b/frontend/src/TaskPanel.svelte index bef0afd..a34f46a 100644 --- a/frontend/src/TaskPanel.svelte +++ b/frontend/src/TaskPanel.svelte @@ -19,29 +19,33 @@ export function unPreselect(task: TaskDescriptor) { setTimeout(() => { - if (selectedTask && task.id == selectedTask.id && heightClass != "full") { + if (selectedTask && task.id == selectedTask.id && heightClass == "preview") { heightClass = "collapsed" } }, 10); } + let lastSelectedTaskId = selectedTaskId + $: { - if (selectedTaskId) { + if (selectedTaskId && lastSelectedTaskId != selectedTaskId) { heightClass = "full" selectedTask = tasks.tasks.find(t => t.id == selectedTaskId) ?? null } else { - heightClass = "collapsed" + if ("full" == heightClass) + heightClass = "collapsed" } + lastSelectedTaskId = selectedTaskId } function close() { - location.hash = "" heightClass = "closed" window.setTimeout(() => window.scrollTo({ top: 0, left: 0, behavior: 'smooth' }), 100) + location.hash = "" } function handleKeydown(e: KeyboardEvent) {