]> git.scottworley.com Git - vopamoi/commitdiff
Never mind about Destroy. Deleting is just state "deleted"
authorScott Worley <scottworley@scottworley.com>
Wed, 26 Jan 2022 22:17:16 +0000 (14:17 -0800)
committerScott Worley <scottworley@scottworley.com>
Thu, 27 Jan 2022 20:21:55 +0000 (12:21 -0800)
It doesn't get erased from the log anyway.

vopamoi.ts

index 7497e54afbda526bbe2fa47fdd2bfa8d9d93cf2e..5e645b8f0fb4a849d943b0abbde9537b97475b6d 100644 (file)
@@ -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 <Element>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");
   }
 }