Fix UI display when removing the last task

Clear All button properly shows the "welcome message", but Remove the last task would just result in a blank Preview pane.
This commit is contained in:
patriceac 2022-11-27 12:25:46 -08:00
parent 347fa0fda1
commit e64e1a92e6

View File

@ -903,7 +903,7 @@ function createTask(task) {
taskQueue.splice(idx, 1)
}
taskEntry.remove()
removeTask(taskEntry)
}
})
@ -1047,16 +1047,22 @@ async function stopAllTasks() {
}
}
function removeTask(taskToRemove) {
taskToRemove.remove()
if (document.querySelectorAll('.imageTaskContainer').length === 0) {
previewTools.style.display = 'none'
initialText.style.display = 'block'
}
}
clearAllPreviewsBtn.addEventListener('click', async function() {
await stopAllTasks()
let taskEntries = document.querySelectorAll('.imageTaskContainer')
taskEntries.forEach(task => {
task.remove()
removeTask(task)
})
previewTools.style.display = 'none'
initialText.style.display = 'block'
})
stopImageBtn.addEventListener('click', async function() {