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
19 changes: 10 additions & 9 deletions web_app/static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,12 +613,14 @@ function handleLyricLineClick(lineNumber) {
async function generatePoster() {
if (!currentMetadata) return;

loadingOverlay.style.display = 'flex';
generateBtn.disabled = true;
generateBtn.textContent = 'Generating...';

const indexingToggle = document.getElementById('indexingToggle');
const accentToggle = document.getElementById('accentToggle');
try {
const indexingToggle = document.getElementById('indexingToggle');
const accentToggle = document.getElementById('accentToggle');

let payload = {
let payload = {
track_id: currentMetadata.id,
metadata: currentMetadata,
theme: themeInput.value,
Expand All @@ -635,7 +637,6 @@ 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");
return;
}
Expand All @@ -648,8 +649,7 @@ async function generatePoster() {
payload.indexing = indexingToggle ? indexingToggle.checked : false;
}

try {
const response = await fetch('/api/generate', {
const response = await fetch('/api/generate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
Expand All @@ -669,13 +669,14 @@ async function generatePoster() {
posterContainer.innerHTML = '';
posterContainer.appendChild(img);
showDownloadButton(imageUrl, data.filename);
loadingOverlay.style.display = 'none';
};

} catch (error) {
console.error("Generation failed", error);
showToast(`Error: ${error.message}`, "error");
loadingOverlay.style.display = 'none';
} finally {
generateBtn.disabled = false;
generateBtn.textContent = 'Generate Poster';
}
}

Expand Down
6 changes: 6 additions & 0 deletions web_app/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ header p {
transform: translateY(-1px);
}

.primary-btn:disabled {
opacity: 0.7;
cursor: not-allowed;
transform: none;
}

.secondary-btn {
background: transparent;
border-color: var(--border-color);
Expand Down