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
5 changes: 4 additions & 1 deletion web_app/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ <h2 id="contentHeading">Lyrics</h2>
</div>
</div>

<button id="generateBtn" class="primary-btn">Generate Poster</button>
<button id="generateBtn" class="primary-btn">
<span class="btn-text">Generate Poster</span>
<div class="spinner btn-spinner" style="display: none;"></div>
</button>
</div>
</div>

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

Expand Down
19 changes: 18 additions & 1 deletion web_app/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -908,4 +908,21 @@ input:focus {

.result-action svg {
pointer-events: none;
}
}
.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 */
}