From f4601a782be693644a11c6f267872454fcc8b701 Mon Sep 17 00:00:00 2001 From: exyi Date: Tue, 29 Sep 2020 14:37:54 +0000 Subject: [PATCH] Implement simple routing for TaskPanel --- frontend/src/App.svelte | 7 ++++--- frontend/src/TaskPanel.svelte | 16 +++++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index 71d4f4d..3631f9a 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -15,8 +15,9 @@ import type { detach } from "svelte/internal"; // react to hash changes let hash = window.location.hash.substr(1); window.onhashchange = () => { - hash = window.location.hash.substr(1); + hash = window.location.hash.substr(1); } + $: selectedTaskId = (/^task\/([^\/]*)/.exec(hash) || [null, null])[1]
selectedTask && select(selectedTask)}> + on:click={() => location.hash = `#task/${selectedTask?.id}`}>