Fix modal
This commit is contained in:
parent
14aec7503e
commit
85550c318e
@ -100,7 +100,7 @@ pub async fn import_opml(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let bytes = file_data.value;
|
let bytes = file_data.value;
|
||||||
|
|
||||||
// Find the start of the actual XML content by looking for double newline
|
// Find the start of the actual XML content by looking for double newline
|
||||||
let content_start = bytes
|
let content_start = bytes
|
||||||
.windows(4)
|
.windows(4)
|
||||||
|
@ -34,19 +34,20 @@
|
|||||||
color: var(--primary-red);
|
color: var(--primary-red);
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-header.error h2 {
|
.modal-header:not(.error) {
|
||||||
display: flex;
|
color: #28a745; /* Success green color */
|
||||||
align-items: center;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-header.error i {
|
|
||||||
font-size: 1.2em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-header h2 {
|
.modal-header h2 {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
color: #333;
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header i {
|
||||||
|
font-size: 1.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-body {
|
.modal-body {
|
||||||
|
@ -35,30 +35,39 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
// Error modal functionality
|
// Error modal functionality
|
||||||
const errorModal = document.getElementById('errorModal');
|
const errorModal = document.getElementById('errorModal');
|
||||||
const errorModalMessage = document.getElementById('errorModalMessage');
|
const errorModalMessage = document.getElementById('errorModalMessage');
|
||||||
|
const errorModalTitle = document.getElementById('errorModalTitle');
|
||||||
const errorModalClose = document.getElementById('errorModalClose');
|
const errorModalClose = document.getElementById('errorModalClose');
|
||||||
|
|
||||||
function showError(message) {
|
function showStatusModal(message, isError = true) {
|
||||||
errorModalMessage.textContent = message;
|
errorModalMessage.textContent = message;
|
||||||
|
const modalHeader = errorModal.querySelector('.modal-header');
|
||||||
|
if (isError) {
|
||||||
|
modalHeader.classList.add('error');
|
||||||
|
errorModalTitle.innerHTML = '<i class="fas fa-exclamation-circle"></i> Error';
|
||||||
|
} else {
|
||||||
|
modalHeader.classList.remove('error');
|
||||||
|
errorModalTitle.innerHTML = '<i class="fas fa-check-circle"></i> Success';
|
||||||
|
}
|
||||||
errorModal.classList.add('show');
|
errorModal.classList.add('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideError() {
|
function hideStatusModal() {
|
||||||
errorModal.classList.remove('show');
|
errorModal.classList.remove('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
errorModalClose.addEventListener('click', hideError);
|
errorModalClose.addEventListener('click', hideStatusModal);
|
||||||
|
|
||||||
// Close error modal when clicking outside
|
// Close error modal when clicking outside
|
||||||
errorModal.addEventListener('click', (e) => {
|
errorModal.addEventListener('click', (e) => {
|
||||||
if (e.target === errorModal) {
|
if (e.target === errorModal) {
|
||||||
hideError();
|
hideStatusModal();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Close error modal when pressing escape
|
// Close error modal when pressing escape
|
||||||
document.addEventListener('keydown', (e) => {
|
document.addEventListener('keydown', (e) => {
|
||||||
if (e.key === 'Escape' && errorModal.classList.contains('show')) {
|
if (e.key === 'Escape' && errorModal.classList.contains('show')) {
|
||||||
hideError();
|
hideStatusModal();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -78,19 +87,19 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
showError(result.message);
|
showStatusModal(result.message, false);
|
||||||
// TODO: Poll job status endpoint when implemented
|
// TODO: Poll job status endpoint when implemented
|
||||||
// For now, just refresh the feed list after a delay
|
// For now, just refresh the feed list after a delay
|
||||||
setTimeout(handleFeeds, 5000);
|
setTimeout(handleFeeds, 5000);
|
||||||
} else {
|
} else {
|
||||||
showError('OPML import failed: ' + result.message);
|
showStatusModal('OPML import failed: ' + result.message, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showError('Failed to import OPML file. Please try again.');
|
showStatusModal('Failed to import OPML file. Please try again.', true);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('OPML import failed:', error);
|
console.error('OPML import failed:', error);
|
||||||
showError('Failed to import OPML file. Please try again.');
|
showStatusModal('Failed to import OPML file. Please try again.', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Clear the input so the same file can be selected again
|
// Clear the input so the same file can be selected again
|
||||||
|
@ -35,11 +35,11 @@
|
|||||||
</article>
|
</article>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
<!-- Error Modal -->
|
<!-- Status Modal -->
|
||||||
<dialog class="modal" id="errorModal">
|
<dialog class="modal" id="errorModal">
|
||||||
<article class="modal-content">
|
<article class="modal-content">
|
||||||
<header class="modal-header error">
|
<header class="modal-header">
|
||||||
<h2><i class="fas fa-exclamation-circle"></i> Error</h2>
|
<h2 id="errorModalTitle"></h2>
|
||||||
</header>
|
</header>
|
||||||
<section class="modal-body">
|
<section class="modal-body">
|
||||||
<p id="errorModalMessage"></p>
|
<p id="errorModalMessage"></p>
|
||||||
|
Loading…
Reference in New Issue
Block a user