From b9ce3f92a4b274e72d0e723b674b10c73477e3fb Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 8 Apr 2025 21:04:44 -0400 Subject: [PATCH] Progress modal for handleExtractZip --- js/fileActions.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/js/fileActions.js b/js/fileActions.js index ed55e7d..cb09080 100644 --- a/js/fileActions.js +++ b/js/fileActions.js @@ -168,6 +168,16 @@ export function handleExtractZipSelected(e) { showToast("No zip files selected."); return; } + + // Change progress modal text to "Extracting files..." + const progressText = document.querySelector("#downloadProgressModal p"); + if (progressText) { + progressText.textContent = "Extracting files..."; + } + + // Show the progress modal. + document.getElementById("downloadProgressModal").style.display = "block"; + fetch("extractZip.php", { method: "POST", credentials: "include", @@ -182,6 +192,8 @@ export function handleExtractZipSelected(e) { }) .then(response => response.json()) .then(data => { + // Hide the progress modal once the request has completed. + document.getElementById("downloadProgressModal").style.display = "none"; if (data.success) { let toastMessage = "Zip file(s) extracted successfully!"; if (data.extractedFiles && Array.isArray(data.extractedFiles) && data.extractedFiles.length) { @@ -194,6 +206,8 @@ export function handleExtractZipSelected(e) { } }) .catch(error => { + // Hide the progress modal on error. + document.getElementById("downloadProgressModal").style.display = "none"; console.error("Error extracting zip files:", error); showToast("Error extracting zip files."); });