Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .Jules/palette.md
Empty file.
4 changes: 2 additions & 2 deletions web_app/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ <h2 id="contentHeading">Lyrics</h2>
</div>
</div>

<button id="generateBtn" class="primary-btn">Generate Poster</button>
<button id="generateBtn" class="primary-btn" disabled>Generate Poster</button>
</div>
</div>

Expand Down Expand Up @@ -147,7 +147,7 @@ <h2>Poster</h2>
<div class="spinner"></div>
<p>Generating your masterpiece...</p>
</div>
<script src="/static/script.js?v=21"></script>
<script src="/static/script.js?v=23"></script>
</body>

</html>
25 changes: 21 additions & 4 deletions web_app/static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand All @@ -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;
}

Expand Down Expand Up @@ -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';
}
}

Expand Down
7 changes: 7 additions & 0 deletions web_app/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down