diff --git a/.Jules/palette.md b/.Jules/palette.md new file mode 100644 index 0000000..e69de29 diff --git a/web_app/static/index.html b/web_app/static/index.html index 0d56371..df7d0fc 100644 --- a/web_app/static/index.html +++ b/web_app/static/index.html @@ -116,7 +116,7 @@

Lyrics

- + @@ -147,7 +147,7 @@

Poster

Generating your masterpiece...

- + \ No newline at end of file diff --git a/web_app/static/script.js b/web_app/static/script.js index 441a4ed..0853adb 100644 --- a/web_app/static/script.js +++ b/web_app/static/script.js @@ -490,6 +490,9 @@ function selectTrack(track) { `; document.getElementById('downloadBtn').style.display = 'none'; + // Enable Generate Button + if (generateBtn) generateBtn.disabled = false; + // Handle Content based on Type const lyricsContent = document.getElementById('lyricsContent'); const tracklistContent = document.getElementById('tracklistContent'); @@ -613,7 +616,9 @@ function handleLyricLineClick(lineNumber) { async function generatePoster() { if (!currentMetadata) return; - loadingOverlay.style.display = 'flex'; + // Set loading state on button, remove global overlay + generateBtn.disabled = true; + generateBtn.textContent = 'Generating...'; const indexingToggle = document.getElementById('indexingToggle'); const accentToggle = document.getElementById('accentToggle'); @@ -635,8 +640,9 @@ async function generatePoster() { const end = endVal; if (isNaN(start) || isNaN(end) || start >= end) { - loadingOverlay.style.display = 'none'; showToast("Please enter a valid range (Start must be less than End).", "error"); + generateBtn.disabled = false; + generateBtn.textContent = 'Generate Poster'; return; } @@ -669,13 +675,24 @@ async function generatePoster() { posterContainer.innerHTML = ''; posterContainer.appendChild(img); showDownloadButton(imageUrl, data.filename); - loadingOverlay.style.display = 'none'; + // Restore button on success + generateBtn.disabled = false; + generateBtn.textContent = 'Generate Poster'; + }; + + img.onerror = () => { + showToast("Error: Failed to load generated poster image.", "error"); + // Restore button on image load failure + generateBtn.disabled = false; + generateBtn.textContent = 'Generate Poster'; }; } catch (error) { console.error("Generation failed", error); showToast(`Error: ${error.message}`, "error"); - loadingOverlay.style.display = 'none'; + // Restore button on fetch failure + generateBtn.disabled = false; + generateBtn.textContent = 'Generate Poster'; } } diff --git a/web_app/static/style.css b/web_app/static/style.css index 468eb76..9f76ba2 100644 --- a/web_app/static/style.css +++ b/web_app/static/style.css @@ -166,6 +166,13 @@ header p { transform: translateY(-1px); } +.primary-btn:disabled { + background: var(--surface-elevated); + color: var(--text-muted); + cursor: not-allowed; + transform: none; +} + .secondary-btn { background: transparent; border-color: var(--border-color);