diff --git a/portal/index.html b/portal/index.html index 14cb578..c37691f 100644 --- a/portal/index.html +++ b/portal/index.html @@ -139,10 +139,20 @@ -
- +
diff --git a/portal/portal.js b/portal/portal.js index 89236f8..fb24814 100644 --- a/portal/portal.js +++ b/portal/portal.js @@ -128,6 +128,24 @@ const Portal = { } }, + // Toggle user dropdown menu + toggleUserMenu() { + const dd = document.getElementById('userDropdown'); + if (!dd) return; + const showing = dd.style.display !== 'none'; + dd.style.display = showing ? 'none' : 'block'; + if (!showing) { + // Close on outside click + const close = (e) => { + if (!dd.contains(e.target) && e.target.id !== 'userBtn' && !e.target.closest('#userBtn')) { + dd.style.display = 'none'; + document.removeEventListener('click', close); + } + }; + setTimeout(() => document.addEventListener('click', close), 0); + } + }, + // Logout logout() { localStorage.removeItem('payfrit_portal_token');