diff --git a/web_app/static/index.html b/web_app/static/index.html
index 0d56371..69569a5 100644
--- a/web_app/static/index.html
+++ b/web_app/static/index.html
@@ -116,7 +116,10 @@
Lyrics
-
+
diff --git a/web_app/static/script.js b/web_app/static/script.js
index 441a4ed..d2e7b10 100644
--- a/web_app/static/script.js
+++ b/web_app/static/script.js
@@ -613,7 +613,20 @@ function handleLyricLineClick(lineNumber) {
async function generatePoster() {
if (!currentMetadata) return;
- loadingOverlay.style.display = 'flex';
+ const btn = document.getElementById('generateBtn');
+ const btnText = btn.querySelector('.btn-text');
+ const btnSpinner = btn.querySelector('.btn-spinner');
+
+ btn.disabled = true;
+ btnText.style.display = 'none';
+ btnSpinner.style.display = 'block';
+
+ const resetBtn = () => {
+ btn.disabled = false;
+ btnText.style.display = 'inline';
+ btnSpinner.style.display = 'none';
+ };
+
const indexingToggle = document.getElementById('indexingToggle');
const accentToggle = document.getElementById('accentToggle');
@@ -635,7 +648,7 @@ async function generatePoster() {
const end = endVal;
if (isNaN(start) || isNaN(end) || start >= end) {
- loadingOverlay.style.display = 'none';
+ resetBtn();
showToast("Please enter a valid range (Start must be less than End).", "error");
return;
}
@@ -669,13 +682,17 @@ async function generatePoster() {
posterContainer.innerHTML = '';
posterContainer.appendChild(img);
showDownloadButton(imageUrl, data.filename);
- loadingOverlay.style.display = 'none';
+ resetBtn();
+ };
+ img.onerror = () => {
+ showToast('Failed to load the generated poster image.', 'error');
+ resetBtn();
};
} catch (error) {
console.error("Generation failed", error);
showToast(`Error: ${error.message}`, "error");
- loadingOverlay.style.display = 'none';
+ resetBtn();
}
}
diff --git a/web_app/static/style.css b/web_app/static/style.css
index 468eb76..1ef50bb 100644
--- a/web_app/static/style.css
+++ b/web_app/static/style.css
@@ -908,4 +908,21 @@ input:focus {
.result-action svg {
pointer-events: none;
-}
\ No newline at end of file
+}
+.primary-btn:disabled {
+ background-color: var(--accent-hover);
+ opacity: 0.7;
+ cursor: not-allowed;
+ transform: none;
+}
+
+.btn-spinner {
+ width: 20px;
+ height: 20px;
+ border-width: 2px;
+ border-top-color: #1a1a1f; /* Match button text color */
+ border-right-color: rgba(26, 26, 31, 0.2);
+ border-bottom-color: rgba(26, 26, 31, 0.2);
+ border-left-color: rgba(26, 26, 31, 0.2);
+ margin: 0; /* Override margin from .spinner */
+}