V1.0.0-beta.17 Update 1
Some checks failed
continuous-integration/drone/push Build was killed
continuous-integration/drone Build was killed

Note: We appreciate your feedback and bug reports to continue improving our platform. Thank you for your continued support!
This commit is contained in:
2024-12-01 22:18:07 +01:00
parent 710ff642e0
commit 243ab5f55e
15 changed files with 2385 additions and 5215 deletions

View File

@@ -1,54 +0,0 @@
body {
background-color: #36393f;
color: #ffffff;
font-family: Arial, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}
.title-container {
margin-bottom: 20px;
}
.container {
width: 300px;
text-align: center;
}
.tittle {
font-size: 24px;
margin-bottom: 20px;
}
input[type="text"],
input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 15px;
background-color: #40444b;
border: none;
color: #ffffff;
border-radius: 5px;
font-size: 16px;
}
button {
background-color: #7289da;
color: #ffffff;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
font-size: 16px;
margin: 0 auto;
display: block;
}
button:hover {
background-color: #677bc4;
}

View File

@@ -0,0 +1,276 @@
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--card: 0 0% 100%;
--card-foreground: 222.2 84% 4.9%;
--popover: 0 0% 100%;
--popover-foreground: 222.2 84% 4.9%;
--primary: 222.2 47.4% 11.2%;
--primary-foreground: 210 40% 98%;
--secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%;
--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;
--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 40% 98%;
--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;
--ring: 222.2 84% 4.9%;
--radius: 0.5rem;
}
.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
--card: 222.2 84% 4.9%;
--card-foreground: 210 40% 98%;
--popover: 222.2 84% 4.9%;
--popover-foreground: 210 40% 98%;
--primary: 210 40% 98%;
--primary-foreground: 222.2 47.4% 11.2%;
--secondary: 217.2 32.6% 17.5%;
--secondary-foreground: 210 40% 98%;
--muted: 217.2 32.6% 17.5%;
--muted-foreground: 215 20.2% 65.1%;
--accent: 217.2 32.6% 17.5%;
--accent-foreground: 210 40% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 40% 98%;
--border: 217.2 32.6% 17.5%;
--input: 217.2 32.6% 17.5%;
--ring: 212.7 26.8% 83.9%;
}
body {
font-family: 'Inter', sans-serif;
background-color: hsl(var(--background));
color: hsl(var(--foreground));
transition: background-color 0.3s ease, color 0.3s ease;
}
.animate {
animation: fadeIn 0.5s ease-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.container {
max-width: 960px;
margin: 0 auto;
padding: 2rem;
}
.form-container {
background-color: hsl(var(--card));
border: 1px solid hsl(var(--border));
border-radius: var(--radius);
padding: 2rem;
transition: all 0.3s ease;
}
.form-group {
margin-bottom: 1rem;
position: relative;
}
.form-control {
width: 100%;
padding: 0.75rem;
border: 1px solid hsl(var(--border));
border-radius: var(--radius);
background-color: hsl(var(--background));
color: hsl(var(--foreground));
transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.form-control:focus {
outline: none;
border-color: hsl(var(--ring));
box-shadow: 0 0 0 2px hsla(var(--ring), 0.2);
}
.btn {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: var(--radius);
font-weight: 500;
transition: all 0.3s ease;
cursor: pointer;
padding: 0.75rem 1.5rem;
overflow: hidden;
}
.btn:active {
transform: scale(0.98);
}
.btn-primary {
background-color: hsl(var(--primary));
color: hsl(var(--primary-foreground));
}
.btn-primary:hover {
opacity: 0.9;
transform: translateY(-1px);
}
.btn-secondary {
background-color: hsl(var(--secondary));
color: hsl(var(--secondary-foreground));
}
.btn-secondary:hover {
opacity: 0.9;
}
/* Animations de succès/échec */
@keyframes successShake {
0%, 100% { transform: translateX(0); background-color: #10B981; }
25% { transform: translateX(-2px); }
75% { transform: translateX(2px); }
}
@keyframes failShake {
0%, 100% { transform: translateX(0); background-color: #EF4444; }
20%, 60% { transform: translateX(-4px); }
40%, 80% { transform: translateX(4px); }
}
.success-animation {
animation: successShake 0.5s ease;
background-color: #10B981 !important;
}
.fail-animation {
animation: failShake 0.5s ease;
background-color: #EF4444 !important;
}
/* Points de chargement */
.loading-dots span {
display: inline-block;
animation: loadingDots 1.4s infinite;
opacity: 0;
margin-left: 2px;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes loadingDots {
0% { opacity: 0; }
50% { opacity: 1; }
100% { opacity: 0; }
}
/* Écran de succès */
.success-circle {
width: 80px;
height: 80px;
background: #10B981;
border-radius: 50%;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: center;
color: white;
animation: scaleIn 0.5s ease;
}
.animate-success {
animation: fadeInUp 0.5s ease;
}
.loading-bar {
height: 4px;
width: 100%;
background-color: hsl(var(--secondary));
border-radius: 2px;
overflow: hidden;
position: relative;
margin-top: 1.5rem;
}
.loading-bar::after {
content: '';
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 40%;
background-color: #10B981;
animation: loadingBar 1.5s infinite ease-in-out;
border-radius: 2px;
}
@keyframes loadingBar {
0% { left: -40%; }
100% { left: 100%; }
}
@keyframes scaleIn {
from { transform: scale(0); opacity: 0; }
to { transform: scale(1); opacity: 1; }
}
@keyframes fadeInUp {
from { transform: translateY(20px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
@keyframes ripple {
from {
transform: translate(-50%, -50%) scale(0);
opacity: 1;
}
to {
transform: translate(-50%, -50%) scale(4);
opacity: 0;
}
}
/* Utilitaires */
.icon-spacing {
margin-right: 0.5rem;
}
/* Thème switcher */
#authlogin-theme-switch {
position: fixed;
top: 1rem;
right: 1rem;
padding: 0.5rem;
border-radius: 50%;
background-color: hsl(var(--card));
border: 1px solid hsl(var(--border));
transition: transform 0.3s ease;
z-index: 100;
}
#authlogin-theme-switch:hover {
transform: rotate(30deg);
}
/* Classes additionnelles pour les textes */
.text-muted-foreground {
color: hsl(var(--muted-foreground));
}
h1 {
transition: all 0.3s ease-in-out;
}

View File

@@ -0,0 +1,461 @@
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--card: 0 0% 100%;
--card-foreground: 222.2 84% 4.9%;
--popover: 0 0% 100%;
--popover-foreground: 222.2 84% 4.9%;
--primary: 222.2 47.4% 11.2%;
--primary-foreground: 210 40% 98%;
--secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%;
--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;
--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 40% 98%;
--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;
--ring: 222.2 84% 4.9%;
--radius: 0.5rem;
}
.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
--card: 222.2 84% 4.9%;
--card-foreground: 210 40% 98%;
--popover: 222.2 84% 4.9%;
--popover-foreground: 210 40% 98%;
--primary: 210 40% 98%;
--primary-foreground: 222.2 47.4% 11.2%;
--secondary: 217.2 32.6% 17.5%;
--secondary-foreground: 210 40% 98%;
--muted: 217.2 32.6% 17.5%;
--muted-foreground: 215 20.2% 65.1%;
--accent: 217.2 32.6% 17.5%;
--accent-foreground: 210 40% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 40% 98%;
--border: 217.2 32.6% 17.5%;
--input: 217.2 32.6% 17.5%;
--ring: 212.7 26.8% 83.9%;
}
.container {
max-width: 90%;
margin: 0 auto;
padding: 2rem;
flex: 1 0 auto;
}
.form-container {
background-color: hsl(var(--card));
border: 1px solid hsl(var(--border));
border-radius: var(--radius);
padding: 2rem;
}
.form-control {
width: 100%;
padding: 0.5rem;
border: 1px solid hsl(var(--border));
border-radius: var(--radius);
background-color: hsl(var(--background));
color: hsl(var(--foreground));
}
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: var(--radius);
font-weight: 500;
transition: all 0.3s ease;
cursor: pointer;
padding: 0.5rem 1rem;
}
.btn-primary {
background-color: hsl(var(--primary));
color: hsl(var(--primary-foreground));
}
.btn-primary:hover {
opacity: 0.9;
}
.btn-secondary {
background-color: hsl(var(--secondary));
color: hsl(var(--secondary-foreground));
}
.btn-secondary:hover {
opacity: 0.9;
}
.btn-success {
background-color: hsl(var(--primary));
color: hsl(var(--primary-foreground));
}
.btn-success:hover {
opacity: 0.9;
}
.btn-danger {
background-color: hsl(var(--destructive));
color: hsl(var(--destructive-foreground));
}
.btn-danger:hover {
opacity: 0.9;
}
.animate {
animation: fadeIn 0.5s ease-out;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.table-responsive {
overflow-x: auto;
}
.table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
}
.table th,
.table td {
padding: 0.75rem;
vertical-align: top;
border-top: 1px solid hsl(var(--border));
}
.table thead th {
vertical-align: bottom;
border-bottom: 2px solid hsl(var(--border));
}
.header {
background-color: hsl(var(--background));
border-bottom: 1px solid hsl(var(--border));
}
.dropdown-menu {
display: none;
background-color: hsl(var(--card));
border: 1px solid hsl(var(--border));
border-radius: var(--radius);
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%);
z-index: 1000;
min-width: 150px;
}
.dropdown-menu.show {
display: block;
}
.dropdown-item {
color: hsl(var(--foreground));
padding: 0.5rem 1rem;
text-decoration: none;
display: block;
}
.dropdown-item:hover {
background-color: hsl(var(--muted));
color: hsl(var(--foreground));
}
.dropdown-divider {
border-top: 1px solid hsl(var(--border));
}
.footer {
flex-shrink: 0;
background-color: hsl(var(--background));
border-top: 1px solid hsl(var(--border));
padding: 1rem 0;
}
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
justify-content: center;
align-items: center;
z-index: 1000;
}
.modal.show {
display: flex;
}
.modal-content {
background-color: hsl(var(--card));
border-radius: 15px;
box-shadow: 0 5px 15px rgba(0,0,0,0.3);
padding: 20px;
max-width: 90%;
width: 600px;
}
.modal-header, .modal-body, .modal-footer {
padding: 20px;
}
.modal-header {
border-bottom: none;
}
.modal-footer {
border-top: none;
display: flex;
justify-content: flex-end;
gap: 0.5rem;
}
.modal .close {
font-size: 28px;
opacity: 0.6;
transition: opacity 0.3s ease;
}
.modal .close:hover {
opacity: 1;
}
.navbar {
padding: 0.5rem 1rem;
}
/* Alignement des boutons à droite */
.navbar {
padding: 0.5rem 1rem !important;
}
.container-fluid {
display: flex !important;
justify-content: space-between !important;
align-items: center !important;
}
/* Alignement des boutons à droite */
.navbar-nav {
display: flex !important;
align-items: center !important;
margin-left: auto !important;
}
.navbar-nav .nav-item {
margin-left: 10px !important;
}
/* Style pour les boutons de la navbar */
.nav-btn {
padding: 0.375rem 0.75rem !important;
font-size: 1rem !important;
line-height: 1.5 !important;
border-radius: 0.25rem !important;
}
/* Style pour l'avatar de l'utilisateur */
.user-avatar {
width: 40px !important;
height: 40px !important;
object-fit: cover !important;
border-radius: 50% !important;
}
/* Style pour le bouton du dropdown */
#accountDropdownBtn {
padding: 0 !important;
border: none !important;
background: none !important;
}
/* Style pour le menu dropdown */
.dropdown-menu {
right: 0 !important;
left: auto !important;
}
/* Assurez-vous que le dropdown est positionné correctement */
.dropdown {
position: relative !important;
}
/* Ajustement pour les écrans plus petits */
@media (max-width: 768px) {
.navbar-nav {
flex-direction: row !important;
justify-content: flex-end !important;
width: 100% !important;
}
.navbar-nav .nav-item {
margin-left: 5px !important;
}
}
/* Animation de chargement stylisée */
.initial-loading {
position: fixed;
inset: 0;
background: linear-gradient(135deg,
hsla(var(--background), 0.85),
hsla(var(--background), 0.9)
);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
z-index: 9999;
}
.success-animation {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
gap: 1.5rem;
}
.success-icon {
width: 64px;
height: 64px;
background-color: #0EA5E9;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
position: relative;
transform: scale(0);
animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.success-icon svg {
width: 32px;
height: 32px;
color: white;
opacity: 0;
transform: scale(0.5);
animation: iconIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 0.2s;
}
.success-text {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
opacity: 0;
transform: translateY(10px);
animation: textIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards 0.4s;
}
.success-text h2 {
margin: 0;
color: hsl(var(--foreground));
font-size: 1.5rem;
font-weight: 600;
}
.success-text p {
margin: 0;
color: hsl(var(--muted-foreground));
font-size: 0.875rem;
}
.success-text .loading-message {
color: hsl(var(--muted-foreground));
font-size: 0.75rem;
opacity: 0.8;
margin-top: 0.5rem;
}
.progress-bar {
width: 200px;
height: 4px;
background: hsla(var(--foreground), 0.1);
border-radius: 2px;
overflow: hidden;
margin-top: 1rem;
opacity: 0;
animation: textIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards 0.6s;
}
.progress-bar::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 40%;
height: 100%;
background-color: #10b981;
border-radius: 2px;
animation: loading 1.5s ease-in-out infinite;
}
@keyframes popIn {
from {
transform: scale(0);
}
to {
transform: scale(1);
}
}
@keyframes iconIn {
to {
opacity: 1;
transform: scale(1);
}
}
@keyframes textIn {
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes loading {
0% {
left: -40%;
}
100% {
left: 100%;
}
}
/* Animation de sortie */
.fade-out {
animation: fadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes fadeOut {
to {
opacity: 0;
}
}

View File

@@ -0,0 +1,134 @@
// Gestion du thème
const body = document.body;
const themeSwitcher = document.getElementById('authlogin-theme-switch');
function setTheme(theme) {
if (theme === 'dark') {
body.classList.add('dark');
} else {
body.classList.remove('dark');
}
localStorage.setItem('theme', theme);
}
// Initialisation du thème
const savedTheme = localStorage.getItem('theme');
if (savedTheme) {
setTheme(savedTheme);
} else if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
setTheme('dark');
}
themeSwitcher.addEventListener('click', () => {
body.classList.contains('dark') ? setTheme('light') : setTheme('dark');
});
// Gestion du formulaire de connexion
document.getElementById('authlogin-form').addEventListener('submit', function(e) {
e.preventDefault();
const username = document.getElementById('authlogin-username').value;
const password = document.getElementById('authlogin-password').value;
const loginButton = document.getElementById('authlogin-submit');
// Animation de chargement
loginButton.disabled = true;
loginButton.innerHTML = `
<div class="loading-dots">
Connexion en cours<span>.</span><span>.</span><span>.</span>
</div>
`;
fetch('/auth/activedirectory', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password }),
redirect: 'follow',
})
.then(response => {
if (response.url.includes('/dpanel/dashboard')) {
loginButton.classList.add('success-animation');
loginButton.innerHTML = '<i class="fas fa-check icon-spacing"></i>Succès!';
// Crée l'effet de vague
const ripple = document.createElement('span');
ripple.style.cssText = `
position: absolute;
background: rgba(255, 255, 255, 0.3);
border-radius: 50%;
pointer-events: none;
width: 200px;
height: 200px;
transform: translate(-50%, -50%) scale(0);
animation: ripple 1s ease-out;
`;
loginButton.appendChild(ripple);
setTimeout(() => {
const formContainer = document.querySelector('.form-container');
const h1Title = document.querySelector('h1');
formContainer.style.opacity = '0';
formContainer.style.transform = 'translateY(-20px) scale(0.98)';
h1Title.style.transform = 'translateY(20px)';
h1Title.style.opacity = '0';
setTimeout(() => {
formContainer.innerHTML = `
<div class="text-center animate-success">
<div class="success-circle mb-4">
<i class="fas fa-check text-4xl"></i>
</div>
<h2 class="text-2xl font-semibold mb-3">Connexion réussie !</h2>
<p class="text-muted-foreground mb-4">Redirection vers le tableau de bord...</p>
<div class="loading-bar"></div>
</div>
`;
formContainer.style.opacity = '1';
formContainer.style.transform = 'translateY(0) scale(1)';
h1Title.textContent = 'Bienvenue !';
h1Title.style.transform = 'translateY(0)';
h1Title.style.opacity = '1';
setTimeout(() => window.location.replace('/dpanel/dashboard'), 1500);
}, 300);
}, 700);
} else {
throw new Error('Échec de la connexion');
}
})
.catch(error => {
loginButton.classList.add('fail-animation');
loginButton.innerHTML = '<i class="fas fa-times icon-spacing"></i>Échec';
if ('vibrate' in navigator) {
navigator.vibrate(100);
}
setTimeout(() => {
loginButton.classList.remove('fail-animation');
loginButton.disabled = false;
loginButton.innerHTML = '<i class="fa-solid fa-user icon-spacing"></i>Se connecter';
}, 1500);
});
});
function redirectToDiscord(url) {
const discordButton = document.getElementById('authlogin-discord');
if (discordButton) {
discordButton.innerHTML = `
<div class="loading-dots">
Redirection en cours<span>.</span><span>.</span><span>.</span>
</div>
`;
discordButton.disabled = true;
setTimeout(() => {
document.querySelector('.form-container').style.opacity = '0';
document.querySelector('.form-container').style.transform = 'translateY(-20px) scale(0.98)';
setTimeout(() => window.location.href = url, 500);
}, 500);
}
}

View File

@@ -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);
}
});