feat: Modal de déconnexion personnalisée remplaçant le confirm natif (v1.2.3)

- Nouvelle modal moderne avec design élégant et animations
- Icône emoji 👋 avec gradient violet et animation pulse
- Textes en français avec titre et description
- Fond flou avec overlay sombre pour meilleur focus
- Trois méthodes de fermeture : bouton, clic externe, Escape
- Suppression du popup système Electron
This commit is contained in:
Pierre Marx
2025-09-04 15:27:22 -04:00
parent fb9430936c
commit da20170bef
4 changed files with 204 additions and 3 deletions

View File

@@ -75,6 +75,13 @@ document.addEventListener('DOMContentLoaded', async () => {
// Charger les préférences utilisateur
loadUserPreferences();
// Gérer les boutons de la modal de déconnexion (si on est sur la page principale)
const cancelLogoutBtn = document.getElementById('cancelLogoutBtn');
const confirmLogoutBtn = document.getElementById('confirmLogoutBtn');
if (cancelLogoutBtn && confirmLogoutBtn) {
// Les event listeners sont gérés dans showLogoutModal()
}
// Écouter les appels entrants
ipcRenderer.on('incoming-call', (event, callData) => {
@@ -177,15 +184,56 @@ async function handleLogin(e) {
}
// Déconnexion
async function handleLogout() {
if (confirm('Voulez-vous vraiment vous déconnecter ?')) {
function handleLogout() {
showLogoutModal();
}
// Afficher la modal de déconnexion
function showLogoutModal() {
const modal = document.getElementById('logoutModal');
modal.classList.add('active');
// Bouton annuler
const cancelBtn = document.getElementById('cancelLogoutBtn');
const confirmBtn = document.getElementById('confirmLogoutBtn');
// Gérer les clics
const handleCancel = () => {
modal.classList.remove('active');
cancelBtn.removeEventListener('click', handleCancel);
confirmBtn.removeEventListener('click', handleConfirm);
};
const handleConfirm = async () => {
modal.classList.remove('active');
await ipcRenderer.invoke('logout');
currentAgent = null;
currentCentres = [];
activeCenter = null;
webviews = {};
showLoginPage();
}
cancelBtn.removeEventListener('click', handleCancel);
confirmBtn.removeEventListener('click', handleConfirm);
};
cancelBtn.addEventListener('click', handleCancel);
confirmBtn.addEventListener('click', handleConfirm);
// Fermer la modal en cliquant en dehors
modal.addEventListener('click', (e) => {
if (e.target === modal) {
handleCancel();
}
});
// Fermer avec Escape
const handleEscape = (e) => {
if (e.key === 'Escape') {
handleCancel();
document.removeEventListener('keydown', handleEscape);
}
};
document.addEventListener('keydown', handleEscape);
}
// === GESTION DES PAGES ===