Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing way to delete tasks from WebUI #876

Closed
kachick opened this issue Jun 22, 2023 · 2 comments
Closed

Missing way to delete tasks from WebUI #876

kachick opened this issue Jun 22, 2023 · 2 comments
Labels
enhancement javascript Pull requests that update Javascript code

Comments

@kachick
Copy link
Collaborator

kachick commented Jun 22, 2023

x Move focused task to Done If focused task is already on Done, it is deleted

TUI has the feature, but it looks nothing in WebUI

#30 might be related, but I think automation is not mandatory

@kachick kachick added enhancement javascript Pull requests that update Javascript code labels Jun 22, 2023
@kachick
Copy link
Collaborator Author

kachick commented Jun 22, 2023

diff --git a/hashira-web/src/hooks.ts b/hashira-web/src/hooks.ts
index 5fbf11c..10cfec4 100644
--- a/hashira-web/src/hooks.ts
+++ b/hashira-web/src/hooks.ts
@@ -66,7 +66,13 @@ export const useUpdateTasks = (): [
         });

         firebase
-          .updateTasks(tasks)
+          .updateTasks(
+            Object.fromEntries(
+              Object.entries(tasks).map(
+                ([key, task], _) => [key, { ...task, IsDeleted: true }],
+              ),
+            ),
+          )

This is my hack to remove a task

@kachick
Copy link
Collaborator Author

kachick commented Jun 22, 2023

                    const tasksToMarkAsDone: firebase.TasksObject = {};
                    for (const v in checkedTasks) {
                      if (checkedTasks[v]) {
                        const task = tasksAndPriorities["Tasks"][v];
                        tasksToMarkAsDone[v] = {
                          ID: task.ID,
                          IsDeleted: task.Place === "DONE",
                          Name: task.Name,
                          Place: "DONE",
                        };
                      }

Ah... calling Mark as Done twice deletes it...

@kachick kachick closed this as completed Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement javascript Pull requests that update Javascript code
Projects
None yet
Development

No branches or pull requests

1 participant