From: Scott Worley Date: Wed, 26 Jan 2022 22:17:16 +0000 (-0800) Subject: Never mind about Destroy. Deleting is just state "deleted" X-Git-Url: http://git.scottworley.com/vopamoi/commitdiff_plain/45cbd5e56cd386532ed16ded6c1b3c7cd6adfef6?ds=sidebyside;hp=4e05a0a2a1072be98d271ac60de9426125e179e4 Never mind about Destroy. Deleting is just state "deleted" It doesn't get erased from the log anyway. --- 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"); } }