aboutsummaryrefslogtreecommitdiff
path: root/src/ToDo.jsx
diff options
context:
space:
mode:
authorAdrián Oliva <adrian.oliva@cimat.mx>2023-05-19 20:52:06 -0600
committerAdrián Oliva <adrian.oliva@cimat.mx>2023-05-19 20:52:06 -0600
commitebb75b93e85416de5c760fe7ba39f14d92c9e732 (patch)
tree9440f9c520354852f76f4554461f7078ae97f69e /src/ToDo.jsx
parent0e96c6939e84ed283ba7229ee9cf8144025c5718 (diff)
downloadToDo-App-FE-ebb75b93e85416de5c760fe7ba39f14d92c9e732.tar.gz
ToDo-App-FE-ebb75b93e85416de5c760fe7ba39f14d92c9e732.zip
Finished details on sorting.
Now it sorts after events like "adding new to do" and "edit a to do."
Diffstat (limited to '')
-rw-r--r--src/ToDo.jsx25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/ToDo.jsx b/src/ToDo.jsx
index 1f290ab..79d6903 100644
--- a/src/ToDo.jsx
+++ b/src/ToDo.jsx
@@ -5,6 +5,7 @@ import {
change_done,
remove_todo,
edit_todo,
+ set_sort_todo,
sort_todo,
select_todos,
select_last_index,
@@ -168,7 +169,8 @@ export function NewToDo() {
new Date().toString(),
})
),
- handle_exit_modal();
+ dispatch(sort_todo());
+ handle_exit_modal();
}}
data-bs-dismiss="modal"
>
@@ -245,23 +247,27 @@ export function ListToDos() {
<th scope="col">Name</th>
<th
scope="col"
- onClick={(e) =>
+ onClick={(e) => {
dispatch(
- sort_todo({
+ set_sort_todo({
where_clicked: "priority",
})
- )
- }
+ ),
+ dispatch(sort_todo());
+ }}
>
{sort_table_header("Priority", my_sorting)}
</th>
<th
scope="col"
- onClick={(e) =>
+ onClick={(e) => {
dispatch(
- sort_todo({ where_clicked: "due_date" })
- )
- }
+ set_sort_todo({
+ where_clicked: "due_date",
+ })
+ ),
+ dispatch(sort_todo());
+ }}
>
{sort_table_header("Due Date", my_sorting)}
</th>
@@ -454,6 +460,7 @@ export function ListToDos() {
priority: edit_priority,
})
),
+ dispatch(sort_todo()),
handle_exit_modal();
}}
data-bs-dismiss="modal"