From: PhiTux Date: Fri, 29 Aug 2025 17:34:31 +0000 (+0200) Subject: added dropdown to settings for mobile screen X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=8ba9fd7d8a4420715b3014f224043c685878222d;p=DailyTxT.git added dropdown to settings for mobile screen --- diff --git a/frontend/src/routes/(authed)/+layout.svelte b/frontend/src/routes/(authed)/+layout.svelte index 47c746d..ee35fb5 100644 --- a/frontend/src/routes/(authed)/+layout.svelte +++ b/frontend/src/routes/(authed)/+layout.svelte @@ -91,6 +91,31 @@ let removeScrollListener = null; let lastComputedSection = 'appearance'; + // Settings section metadata for mobile dropdown navigation + const settingsSectionsMeta = [ + { id: 'appearance', labelKey: 'settings.appearance' }, + { id: 'functions', labelKey: 'settings.functions' }, + { id: 'tags', labelKey: 'settings.tags' }, + { id: 'templates', labelKey: 'settings.templates' }, + { id: 'data', labelKey: 'settings.data' }, + { id: 'security', labelKey: 'settings.security' }, + { id: 'about', labelKey: 'settings.about' } + ]; + + function scrollToSection(id) { + const container = document.getElementById('settings-content'); + if (!container) return; + const target = container.querySelector(':scope > #' + CSS.escape(id)); + if (!target) return; + // Calculate dynamic offset (mobile dropdown height if visible) + let offset = 4; + const mobileBar = container.querySelector('.mobile-settings-dropdown'); + if (mobileBar && getComputedStyle(mobileBar).display !== 'none') { + offset = mobileBar.getBoundingClientRect().height + 6; // add small gap + } + container.scrollTo({ top: target.offsetTop - offset, behavior: 'smooth' }); + } + function computeActiveSection(container) { if (!container || settingsSections.length === 0) return; // Activation line: a bit below the top to give stability @@ -868,7 +893,7 @@