From f65b151bc3e97a795f8cd1f25421f6620130ac73 Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 8 Apr 2025 20:30:17 -0400 Subject: [PATCH] Progress Modal on download buttons --- CHANGELOG.md | 8 ++++ css/styles.css | 14 +++++++ index.html | 22 +++++++++++ js/domUtils.js | 11 +++--- js/fileActions.js | 98 ++++++++++++++++++++++++++++++++++++++++++---- js/fileListView.js | 11 +++--- js/i18n.js | 2 + js/main.js | 4 +- 8 files changed, 152 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82f13a7..099c502 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,14 @@ - Updated the t() function to be more defensive against missing keys. - Provided instructions and code examples to ensure the language change settings are reliably saved and applied across sessions. +- **ZIP Download Flow** + - Progress Modal: In the ZIP download handler (confirmDownloadZip), added code to show a progress modal (with a spinning icon) as soon as the user confirms the download and before the request to create the ZIP begins. Once the blob is received or an error occurs, we hide the progress modal. + - Inline Handlers and Global Exposure: Ensured that functions like confirmDownloadZip are attached to the global window object (or called via appropriate inline handlers) so that the inline onclick events in the HTML work without reference errors. + +- **Single File Download Flow** + - Modal Popup for Single File: Replaced the direct download link for single files with a modal-driven flow. When the download button is clicked, the openDownloadModal(fileName, folder) function is called. This stores the file details and shows a modal where the user can confirm (or edit) the file name. + - Confirm Download Function: When the user clicks the Download button in the modal, the confirmSingleDownload() function is called. This function constructs a URL for download.php (using GET parameters for folder and file), fetches the file as a blob, and triggers a download using a temporary anchor element. A progress modal is also used here to give feedback during the download process. + --- ## Changes 4/7/2025 v1.0.9 diff --git a/css/styles.css b/css/styles.css index 506521e..eb611b3 100644 --- a/css/styles.css +++ b/css/styles.css @@ -2065,6 +2065,20 @@ body.dark-mode .admin-panel-content label { animation: spin 1s linear infinite; } +.download-spinner { + font-size: 48px; + animation: spin 2s linear infinite; + color: var(--download-spinner-color, #000); +} + +body:not(.dark-mode) { + --download-spinner-color: #000; +} + +body.dark-mode { + --download-spinner-color: #fff; +} + .rise-effect { transform: translateY(-20px); transition: transform 0.3s ease; diff --git a/index.html b/index.html index c82b48b..96462e8 100644 --- a/index.html +++ b/index.html @@ -342,6 +342,28 @@ + + + + + +