diff --git a/config.php b/config.php index 33042c8..23304c5 100644 --- a/config.php +++ b/config.php @@ -1,7 +1,7 @@ { $('view-' + v)?.classList.add('hidden'); }); @@ -40,13 +36,17 @@ function showView(name) { if (['compose', 'account', 'admin'].includes(name)) { $('nav-buttons').classList.remove('hidden'); - $('nav-buttons').style.display = 'flex'; $('nav-compose').classList.toggle('active', name === 'compose'); $('nav-account').classList.toggle('active', name === 'account'); $('nav-admin').classList.toggle('active', name === 'admin'); + $('nav-burger')?.classList.remove('hidden'); + // Picking a view also collapses the mobile menu so it doesn't + // hover over the freshly-shown view. + $('nav-buttons').classList.remove('menu-open'); } else { // Setup, login, and forced change-password hide all nav $('nav-buttons').classList.add('hidden'); + $('nav-burger')?.classList.add('hidden'); } if (name === 'compose') { @@ -63,6 +63,22 @@ function showView(name) { } } +/** Burger toggle for the mobile nav. The button is hidden on desktop + * via CSS, on mobile it expands #nav-buttons as a dropdown panel + * positioned under the header. */ +function toggleNavMenu() { + $('nav-buttons')?.classList.toggle('menu-open'); +} +window.toggleNavMenu = toggleNavMenu; +// Tap outside the menu closes it +document.addEventListener('click', (e) => { + const nav = $('nav-buttons'); + const burger = $('nav-burger'); + if (!nav?.classList.contains('menu-open')) return; + if (nav.contains(e.target) || burger?.contains(e.target)) return; + nav.classList.remove('menu-open'); +}); + async function doChangePassword() { const current = $('cp-current').value; const newPw = $('cp-new').value; diff --git a/relay/ui/layout.php b/relay/ui/layout.php index ab3997d..d273261 100644 --- a/relay/ui/layout.php +++ b/relay/ui/layout.php @@ -17,7 +17,8 @@ if (!defined('RELAY_BOOTSTRAPPED')) { http_response_code(404); exit; }

hyprcrd relay

-