mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 13:40:27 +02:00
feat: Update conversion button labels and status messages for clarity
This commit is contained in:
@@ -279,7 +279,7 @@ if (modal && browser) {
|
|||||||
const queueButton = document.createElement('button');
|
const queueButton = document.createElement('button');
|
||||||
queueButton.type = 'button';
|
queueButton.type = 'button';
|
||||||
queueButton.className = 'button';
|
queueButton.className = 'button';
|
||||||
queueButton.textContent = 'Queue for conversion';
|
queueButton.textContent = 'Configure conversion';
|
||||||
queueButton.addEventListener('click', () => importEntry(entry, queueButton));
|
queueButton.addEventListener('click', () => importEntry(entry, queueButton));
|
||||||
actions.appendChild(queueButton);
|
actions.appendChild(queueButton);
|
||||||
} else if (entryType === EntryTypes.NAVIGATION && navigationLink) {
|
} else if (entryType === EntryTypes.NAVIGATION && navigationLink) {
|
||||||
@@ -349,11 +349,13 @@ if (modal && browser) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const button = trigger;
|
const button = trigger;
|
||||||
|
const originalLabel = button ? button.textContent : '';
|
||||||
if (button) {
|
if (button) {
|
||||||
button.disabled = true;
|
button.disabled = true;
|
||||||
button.dataset.loading = 'true';
|
button.dataset.loading = 'true';
|
||||||
|
button.textContent = 'Preparing…';
|
||||||
}
|
}
|
||||||
setStatus(`Queueing "${entry.title || 'Untitled'}"…`, 'loading');
|
setStatus('Downloading book from Calibre. This can take a minute…', 'loading');
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/api/integrations/calibre-opds/import', {
|
const response = await fetch('/api/integrations/calibre-opds/import', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -364,9 +366,12 @@ if (modal && browser) {
|
|||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(payload.error || 'Unable to queue this book.');
|
throw new Error(payload.error || 'Unable to queue this book.');
|
||||||
}
|
}
|
||||||
setStatus('Book queued. Opening the conversion wizard…', 'success');
|
setStatus('Preparing the conversion wizard…', 'success');
|
||||||
if (payload.redirect_url) {
|
if (payload.redirect_url) {
|
||||||
window.location.href = payload.redirect_url;
|
closeModal();
|
||||||
|
window.setTimeout(() => {
|
||||||
|
window.location.assign(payload.redirect_url);
|
||||||
|
}, 150);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setStatus(error instanceof Error ? error.message : 'Unable to queue this book.', 'error');
|
setStatus(error instanceof Error ? error.message : 'Unable to queue this book.', 'error');
|
||||||
@@ -374,6 +379,9 @@ if (modal && browser) {
|
|||||||
if (button) {
|
if (button) {
|
||||||
button.disabled = false;
|
button.disabled = false;
|
||||||
delete button.dataset.loading;
|
delete button.dataset.loading;
|
||||||
|
if (originalLabel) {
|
||||||
|
button.textContent = originalLabel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user