V1.0.0-beta.17 Update 1
Note: We appreciate your feedback and bug reports to continue improving our platform. Thank you for your continued support!
This commit is contained in:
@@ -501,4 +501,234 @@
|
||||
text: 'Impossible de récupérer les métadonnées'
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// Recherche avec debounce
|
||||
const searchInput = document.getElementById('searchInput');
|
||||
if (searchInput) {
|
||||
let timeout;
|
||||
searchInput.addEventListener('input', (e) => {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => {
|
||||
const term = e.target.value.toLowerCase();
|
||||
document.querySelectorAll('#fileTable tbody tr').forEach(row => {
|
||||
const text = row.querySelector('td:first-child').textContent.toLowerCase();
|
||||
row.style.display = text.includes(term) ? '' : 'none';
|
||||
});
|
||||
}, 150);
|
||||
});
|
||||
}
|
||||
|
||||
// Gestion des modales
|
||||
document.querySelectorAll('[data-toggle="modal"]').forEach(trigger => {
|
||||
trigger.addEventListener('click', () => {
|
||||
const modal = document.querySelector(trigger.dataset.target);
|
||||
if (modal) modal.classList.add('show');
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll('.modal .close, .modal .btn-secondary').forEach(btn => {
|
||||
btn.addEventListener('click', () => {
|
||||
const modal = btn.closest('.modal');
|
||||
if (modal) modal.classList.remove('show');
|
||||
});
|
||||
});
|
||||
|
||||
// Dropdowns
|
||||
document.querySelectorAll('.dropdown-toggle').forEach(toggle => {
|
||||
toggle.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const menu = toggle.nextElementSibling;
|
||||
if (!menu) return;
|
||||
|
||||
// Fermer les autres dropdowns
|
||||
document.querySelectorAll('.dropdown-menu.show').forEach(m => {
|
||||
if (m !== menu) m.classList.remove('show');
|
||||
});
|
||||
|
||||
menu.classList.toggle('show');
|
||||
});
|
||||
});
|
||||
|
||||
// Fermer les dropdowns au clic extérieur
|
||||
document.addEventListener('click', () => {
|
||||
document.querySelectorAll('.dropdown-menu.show').forEach(menu => {
|
||||
menu.classList.remove('show');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Loading overlay
|
||||
window.showLoadingState = () => {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'loading-overlay animate';
|
||||
overlay.innerHTML = '<div class="loading-spinner"></div>';
|
||||
document.body.appendChild(overlay);
|
||||
};
|
||||
|
||||
window.hideLoadingState = () => {
|
||||
const overlay = document.querySelector('.loading-overlay');
|
||||
if (overlay) overlay.remove();
|
||||
};
|
||||
|
||||
// Gestion améliorée de l'état de chargement
|
||||
window.showLoadingState = () => {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'loading-overlay';
|
||||
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.className = 'spinner-wrapper';
|
||||
|
||||
const spinner = document.createElement('div');
|
||||
spinner.className = 'loading-spinner';
|
||||
|
||||
wrapper.appendChild(spinner);
|
||||
overlay.appendChild(wrapper);
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
// Force le reflow pour démarrer l'animation
|
||||
overlay.offsetHeight;
|
||||
overlay.classList.add('show');
|
||||
};
|
||||
|
||||
window.hideLoadingState = () => {
|
||||
const overlay = document.querySelector('.loading-overlay');
|
||||
if (overlay) {
|
||||
overlay.classList.remove('show');
|
||||
overlay.addEventListener('transitionend', () => overlay.remove(), { once: true });
|
||||
}
|
||||
};
|
||||
|
||||
// Animation des lignes du tableau
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const tableRows = document.querySelectorAll('.table tr');
|
||||
tableRows.forEach((row, index) => {
|
||||
row.style.setProperty('--row-index', index);
|
||||
requestAnimationFrame(() => row.classList.add('show'));
|
||||
});
|
||||
|
||||
// Animation du conteneur principal
|
||||
const mainContainer = document.querySelector('.form-container');
|
||||
if (mainContainer) {
|
||||
requestAnimationFrame(() => mainContainer.classList.add('show'));
|
||||
}
|
||||
});
|
||||
|
||||
// Fonction pour les transitions de page
|
||||
function transitionToPage(url) {
|
||||
document.body.classList.add('page-transition');
|
||||
showLoadingState();
|
||||
|
||||
setTimeout(() => {
|
||||
window.location.href = url;
|
||||
}, 300);
|
||||
}
|
||||
|
||||
// Amélioration des modales
|
||||
function showModal(modalId) {
|
||||
const modal = document.querySelector(modalId);
|
||||
if (!modal) return;
|
||||
|
||||
modal.style.display = 'flex';
|
||||
requestAnimationFrame(() => {
|
||||
modal.classList.add('show');
|
||||
modal.querySelector('.modal-content')?.classList.add('show');
|
||||
});
|
||||
}
|
||||
|
||||
function hideModal(modalId) {
|
||||
const modal = document.querySelector(modalId);
|
||||
if (!modal) return;
|
||||
|
||||
modal.querySelector('.modal-content')?.classList.remove('show');
|
||||
modal.classList.remove('show');
|
||||
|
||||
modal.addEventListener('transitionend', () => {
|
||||
modal.style.display = 'none';
|
||||
}, { once: true });
|
||||
}
|
||||
|
||||
// État de chargement des boutons
|
||||
function setButtonLoading(button, isLoading) {
|
||||
if (isLoading) {
|
||||
button.classList.add('loading');
|
||||
button.dataset.originalText = button.innerHTML;
|
||||
button.innerHTML = '';
|
||||
} else {
|
||||
button.classList.remove('loading');
|
||||
if (button.dataset.originalText) {
|
||||
button.innerHTML = button.dataset.originalText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createLoadingScreen() {
|
||||
const container = document.createElement('div');
|
||||
container.className = 'initial-loading';
|
||||
const content = `
|
||||
<div class="success-animation">
|
||||
<div class="success-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="success-text">
|
||||
<h2>Vous y êtes presque !</h2>
|
||||
<p>Préparation de votre espace de travail...</p>
|
||||
<p class="loading-message">Chargement des données</p>
|
||||
</div>
|
||||
<div class="progress-bar"></div>
|
||||
</div>
|
||||
`;
|
||||
container.innerHTML = content;
|
||||
document.body.appendChild(container);
|
||||
return container;
|
||||
}
|
||||
|
||||
function initializeLoadingScreen() {
|
||||
// Vérifier si c'est la première visite de la session
|
||||
const hasSeenAnimation = sessionStorage.getItem('hasSeenLoadingAnimation');
|
||||
|
||||
if (hasSeenAnimation) {
|
||||
// Si l'animation a déjà été vue, initialiser directement le contenu
|
||||
const contentWrapper = document.querySelector('.content-wrapper');
|
||||
if (contentWrapper) {
|
||||
contentWrapper.classList.add('loaded');
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
const loadingScreen = createLoadingScreen();
|
||||
|
||||
setTimeout(() => {
|
||||
loadingScreen.classList.add('fade-out');
|
||||
loadingScreen.addEventListener('animationend', () => {
|
||||
loadingScreen.remove();
|
||||
// Marquer l'animation comme vue pour cette session
|
||||
sessionStorage.setItem('hasSeenLoadingAnimation', 'true');
|
||||
resolve();
|
||||
}, { once: true });
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
// Nettoyer le sessionStorage lors de la déconnexion
|
||||
function handleLogout() {
|
||||
sessionStorage.removeItem('hasSeenLoadingAnimation');
|
||||
// Votre code de déconnexion existant...
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async function() {
|
||||
try {
|
||||
await initializeLoadingScreen();
|
||||
const contentWrapper = document.querySelector('.content-wrapper');
|
||||
if (contentWrapper) {
|
||||
contentWrapper.classList.add('loaded');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Erreur lors du chargement:', error);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user