From 71a6b448903b273f53657e782d970aef90d9f0b1 Mon Sep 17 00:00:00 2001 From: deathcat Date: Wed, 11 Feb 2026 16:59:32 -0800 Subject: [PATCH] Fixed user button and dropdown UI --- index.php | 101 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 93 insertions(+), 8 deletions(-) diff --git a/index.php b/index.php index a58a70e..1b89a1a 100644 --- a/index.php +++ b/index.php @@ -78,11 +78,6 @@ padding: 0.5rem 1rem; } - .add-project-btn { - font-size: 1.5rem; /* increase to your desired size */ - line-height: 1; - } - .settings-btn { font-size: 1.5rem; /* increase to your desired size */ line-height: 1; @@ -136,6 +131,41 @@ color: #d00; } + .user-menu-btn { + font-size: 1.4rem; + padding: 0.5rem 0.9rem; + } + + .header-action-btn { + font-size: 1.4rem; + padding: 0.6rem 0.9rem; + display: flex; + align-items: center; + justify-content: center; + } + + .add-project-btn { + font-size: 1.4rem; + padding: 0.5rem 1rem; + } + + .custom-dropdown { + min-width: 120px; + text-align: right; + } + + .custom-dropdown .dropdown-item { + display: flex; + justify-content: space-between; + align-items: center; + } + + .custom-dropdown .dropdown-item, + .custom-dropdown .dropdown-item-text { + font-size: 1.5rem !important; + text-align: right; + } + .project-color-0 { background-color: #f9f9fc; } .project-color-1 { background-color: #eefaf5; } .project-color-2 { background-color: #fef7e0; } @@ -228,9 +258,38 @@ - + + + + + @@ -910,6 +969,11 @@ document.querySelectorAll('.project-column').forEach(col => { return; } + // Add user name to user menu + if (me.logged_in) { + document.getElementById('dropdownUserEmail').textContent = me.user.email; + } + // Hide settings button if user can't manage settings if (!me.user.can_manage_settings) { document.querySelectorAll('.settings-btn').forEach(b => b.style.display = 'none'); @@ -918,7 +982,28 @@ document.querySelectorAll('.project-column').forEach(col => { fetchProjects(); }); }); - + + document.addEventListener('DOMContentLoaded', () => { + const logoutBtn = document.getElementById('logoutBtn'); + + if (logoutBtn) { + logoutBtn.addEventListener('click', () => { + fetch('logout.php') + .then(res => res.json()) + .then(data => { + if (!data.success) return; + + // Clear UI + document.getElementById('projectGrid').innerHTML = ''; + + // Show login modal + new bootstrap.Modal(document.getElementById('loginModal')).show(); + }) + .catch(err => console.error('Logout failed:', err)); + }); + } + }); + -- 2.49.1