From 45cbd5e56cd386532ed16ded6c1b3c7cd6adfef6 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Wed, 26 Jan 2022 14:17:16 -0800 Subject: [PATCH 1/1] Never mind about Destroy. Deleting is just state "deleted" It doesn't get erased from the log anyway. --- vopamoi.ts | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/vopamoi.ts b/vopamoi.ts index 7497e54..5e645b8 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -25,13 +25,6 @@ const Model = { return task; }, - destroyTask: function (createTimestamp: string) { - const task = this.getTask(createTimestamp); - if (task) { - task.parentElement!.removeChild(task); - } - }, - getPriority: function (task: Element): number { if (task.hasAttribute("data-priority")) { return parseFloat(task.getAttribute("data-priority")!); @@ -81,9 +74,6 @@ function Log(prefix: string = "vp-") { if (command == "Create") { return Model.addTask(timestamp, data); } - if (command == "Destroy") { - return Model.destroyTask(data.split(" ", 1)[0]); - } if (command == "State") { const [createTimestamp, state] = splitN(data, " ", 1); return Model.setState(timestamp, createTimestamp, state); @@ -121,9 +111,6 @@ const UI = { addTask: function (description: string): Element { return log.recordAndApply(`${Date.now()} Create ${description}`); }, - destroyTask: function (createTimestamp: string) { - return log.recordAndApply(`${Date.now()} Destroy ${createTimestamp} ${Model.getTask(createTimestamp)?.textContent}`); - }, setPriority: function (createTimestamp: string, priority: number) { return log.recordAndApply(`${Date.now()} Priority ${createTimestamp} ${priority}`); }, @@ -231,7 +218,7 @@ function handleKey(event: any) { if (event.key == "w") return BrowserUI.setState("waiting"); if (event.key == "d") return BrowserUI.setState("done"); if (event.key == "c") return BrowserUI.setState("cancelled"); - if (event.key == "X") return BrowserUI.destroyTask(); + if (event.key == "X") return BrowserUI.setState("deleted"); } } -- 2.44.1