diff options
author | Adrián Oliva <adrian.oliva@cimat.mx> | 2023-05-27 14:26:14 -0600 |
---|---|---|
committer | Adrián Oliva <adrian.oliva@cimat.mx> | 2023-05-27 14:26:14 -0600 |
commit | 19f07e834e68c6924e19589641e5b138b0535e53 (patch) | |
tree | e186ec1980f5e74cb1d4a72903970b907ef7f966 | |
parent | e04bff29bf8146bb709a76fc187e0683065e4f03 (diff) | |
download | ToDo-App-FE-19f07e834e68c6924e19589641e5b138b0535e53.tar.gz ToDo-App-FE-19f07e834e68c6924e19589641e5b138b0535e53.zip |
"Done" can now only be changed on table.
Not on "edit to do" or "new to do".
-rw-r--r-- | src/ToDo-UI/ListToDo.jsx | 19 | ||||
-rw-r--r-- | src/ToDo-UI/NewToDo.jsx | 16 | ||||
-rw-r--r-- | src/features/todo/reducer.js | 3 |
3 files changed, 2 insertions, 36 deletions
diff --git a/src/ToDo-UI/ListToDo.jsx b/src/ToDo-UI/ListToDo.jsx index 7c2ccba..c77c64b 100644 --- a/src/ToDo-UI/ListToDo.jsx +++ b/src/ToDo-UI/ListToDo.jsx @@ -143,14 +143,12 @@ export function ListToDos() { const [edit_id, set_edit_id] = useState(-1); const [edit_text, set_edit_text] = useState(""); const [edit_due_date, set_edit_due_date] = useState(""); - const [edit_done, set_edit_done] = useState(false); const [edit_priority, set_edit_priority] = useState("Low"); function handle_open_modal(id, text, due_date, done, priority) { set_edit_id(id); set_edit_text(text); set_edit_due_date(due_date); - set_edit_done(done); set_edit_priority(priority); } function handle_exit_modal() { @@ -159,7 +157,6 @@ export function ListToDos() { set_edit_id(-1); set_edit_text(""); - set_edit_done(false); set_edit_priority("Low"); } function handle_edit_todo() { @@ -168,7 +165,6 @@ export function ListToDos() { id: edit_id, text: edit_text, due_date: edit_due_date, - done: edit_done, priority: edit_priority, }) ); @@ -286,21 +282,6 @@ export function ListToDos() { <label htmlFor="edit-todo-due-date">Due Date</label> </div> </div> - <div className="form-check mb-3"> - <input - className="form-check-input" - type="checkbox" - id="edit-todo-done" - onClick={(e) => set_edit_done(e.target.checked)} - checked={edit_done} - /> - <label - className="form-check-label" - htmlFor="edit-todo-done" - > - Completed - </label> - </div> <div className="form-floating mb-3"> <select className="form-select" diff --git a/src/ToDo-UI/NewToDo.jsx b/src/ToDo-UI/NewToDo.jsx index 2fd70b8..e81cb4e 100644 --- a/src/ToDo-UI/NewToDo.jsx +++ b/src/ToDo-UI/NewToDo.jsx @@ -42,7 +42,6 @@ export function NewToDo() { const dispatch = useDispatch(); const [new_text, set_new_text] = useState(""); const [new_due_date, set_new_due_date] = useState(""); - const [new_done, set_new_done] = useState(false); const [new_priority, set_new_priority] = useState("Low"); function handle_exit_modal() { @@ -51,7 +50,6 @@ export function NewToDo() { set_new_text(""); set_new_due_date(""); - set_new_done(false); set_new_priority("Low"); } function handle_add_todo() { @@ -59,7 +57,6 @@ export function NewToDo() { add_todo({ text: new_text, due_date: new_due_date, - done: new_done, priority: new_priority, creation_date: new Date().toString(), }) @@ -129,7 +126,7 @@ export function NewToDo() { <div className="form-floating"> <input className="form-control" - type="date" + type="datetime-local" id="new-todo-due-date" placeholder="Due date" onChange={(e) => { @@ -139,17 +136,6 @@ export function NewToDo() { <label htmlFor="new-todo-due-date">Due Date</label> </div> </div> - <div className="form-check mb-3"> - <input - className="form-check-input" - type="checkbox" - id="new-todo-done" - onClick={(e) => set_new_done(e.target.checked)} - /> - <label className="form-check-label" htmlFor="new-todo-done"> - Completed - </label> - </div> <div className="form-floating mb-3"> <select className="form-select" diff --git a/src/features/todo/reducer.js b/src/features/todo/reducer.js index d62e599..16fc427 100644 --- a/src/features/todo/reducer.js +++ b/src/features/todo/reducer.js @@ -24,7 +24,7 @@ export const todo_slice = createSlice({ id: ++state.last_id, text: action.payload.text, due_date: action.payload.due_date, - done: action.payload.done, + done: false, priority: action.payload.priority, creation_date: action.payload.creation_date, }, @@ -79,7 +79,6 @@ export const todo_slice = createSlice({ state.todos[selected_todo].text = action.payload.text; state.todos[selected_todo].due_date = action.payload.due_date; - state.todos[selected_todo].done = action.payload.done; state.todos[selected_todo].priority = action.payload.priority; }, |