Skip to content

Commit 368901f

Browse files
Fix task count display after deletion and add renderCategories callsFix task count display after deletion and add renderCategories callsUpdate script.js
1 parent 1e1673a commit 368901f

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

script.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,15 @@ const renderCategories = () => {
225225
});
226226
div.innerHTML = `
227227
<div class="left">
228-
<img src="${category.img}" alt="${category.title}" />
228+
<img alt="${category.title}"/>
229229
<div class="content">
230-
<h1>${category.title}</h1>
231-
<p>${categoryTasks.length} Tasks</p>
230+
${category.title}
231+
${categoryTasks.length} Tasks
232232
</div>
233233
</div>
234234
<div class="options">
235235
<div class="toggle-btn">
236-
<svg
236+
<svg>
237237
xmlns="http://www.w3.org/2000/svg"
238238
fill="none"
239239
viewBox="0 0 24 24"
@@ -279,7 +279,7 @@ const renderTasks = () => {
279279
});
280280
div.innerHTML = `
281281
<div class="delete">
282-
<svg
282+
<svg>
283283
xmlns="http://www.w3.org/2000/svg"
284284
fill="none"
285285
viewBox="0 0 24 24"
@@ -297,7 +297,7 @@ const renderTasks = () => {
297297
`;
298298
label.innerHTML = `
299299
<span class="checkmark">
300-
<svg
300+
<svg>
301301
xmlns="http://www.w3.org/2000/svg"
302302
fill="none"
303303
viewBox="0 0 24 24"
@@ -323,10 +323,10 @@ const renderTasks = () => {
323323
tasks.splice(index, 1);
324324
saveLocal();
325325
renderTasks();
326+
renderCategories();
327+
updateTotals();
326328
});
327329
});
328-
renderCategories();
329-
updateTotals();
330330
}
331331
};
332332
const toggleAddTaskForm = () => {
@@ -352,6 +352,8 @@ const addTask = (e) => {
352352
saveLocal();
353353
toggleAddTaskForm();
354354
renderTasks();
355+
renderCategories();
356+
updateTotals();
355357
}
356358
};
357359
// Initialize variables and DOM elements
@@ -382,6 +384,7 @@ cancelBtn.addEventListener("click", toggleAddTaskForm);
382384
// Render initial state
383385
getLocal();
384386
renderTasks();
387+
renderCategories();
385388
categories.forEach((category) => {
386389
const option = document.createElement("option");
387390
option.value = category.title.toLowerCase();

0 commit comments

Comments
 (0)