Skip to content

Commit 360450f

Browse files
Task Description Fix
- This is a mess - When clicking from active/progress task -> complete it will hide the previous task's description - When clicking from complete -> active/progress it will hide the previous task's description - Working as intended now
1 parent dfcf7cc commit 360450f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/taskView.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ let projectStatus;
2323
let currentAddStatus; // This is used when adding a task. Clicking on a button will change it
2424
let currentOpenEditTaskID;
2525
let currentOpenEditTaskStatus;
26+
let hasOpenedCompleteTask; // I hate this messy code
2627

2728
let previousTaskContainer; // This will be used to close task items when clicking another
2829

@@ -162,6 +163,7 @@ async function populateTasks(tasks, status){
162163
previousTaskContainer = toDoItemContainer_el;
163164
if (!toDoItemContainer_el.isDivClicked) {
164165
if (element.status === 'complete'){
166+
hasOpenedCompleteTask = true;
165167
toDoText_el.style.display = 'grid';
166168
}
167169
toDoItemContainer_el.style.maxHeight = 'none';
@@ -231,7 +233,10 @@ function closePreviousContainer(container, status) {
231233
const previousBulletpointList = container.querySelector('.bulletpoint-list');
232234
const inputButtons = container.querySelectorAll('.input-button');
233235

234-
if (status === 'complete'){
236+
if (status !== 'complete' && hasOpenedCompleteTask){
237+
hasOpenedCompleteTask = false;
238+
taskDescriptionElement.style.display = 'none';
239+
} else if (status === 'complete' && hasOpenedCompleteTask){
235240
taskDescriptionElement.style.display = 'none';
236241
}
237242
container.isDivClicked = false;

0 commit comments

Comments
 (0)