Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Two fixes for the settings page — (1) bring back horizontal tab scrolling: new .tabs-scroller primitive wraps any .tabs container with overlaid left/right chevron buttons that only appear when there is content to scroll to; wheel-over-tabs maps vertical wheel to horizontal scroll for mouse users; touch-pan still works natively; ResizeObserver keeps the chevron visibility in sync as the window or tabs content resizes; auto-init on any [data-tabs-scroller] element via the small script in components/page-header.html so it's idempotent; (2) fix the light-mode theme bug on the settings dark mode toggle — the handler only flipped the .dark class without re-applying the saved color scheme, so the previous theme-dark-{amber/emerald/etc} class stayed on documentElement and theme-light-{same} was never added, causing the page to fall back to the default light blue palette; the handler now calls applyTheme() after toggling so the theme-{light|dark}-* class flips with the mode
Murtaza Nasira3234c73edb8
diff --git a/static/css/primitives.css b/static/css/primitives.cssindex 62084a31..807e33b1 100644--- a/static/css/primitives.css+++ b/static/css/primitives.css@@ -343,6 +343,67 @@ html.dark {}+/* ---- Tabs scroller — horizontal-scroll affordance for long tab strips.+ *+ * Wraps a .tabs container with overlaid left/right chevron buttons that+ * appear only when there's content to scroll to in that direction.+ * Wheel-over-tabs translates vertical scroll to horizontal so the user+ * doesn't need to use the buttons. The native scrollbar is hidden but+ * native touch panning still works on mobile.+ *+ * <div class="tabs-scroller" data-tabs-scroller>+ * <button class="tabs-scroller__nav tabs-scroller__nav--left" aria-label="Scroll left"><i class="fas fa-chevron-left"></i></button>+ * <nav class="tabs">...</nav>+ * <button class="tabs-scroller__nav tabs-scroller__nav--right" aria-label="Scroll right"><i class="fas fa-chevron-right"></i></button>+ * </div>+ *+ * The auto-init script (see assets/js/tabs-scroller.js or the inline+ * snippet in page-header.html) attaches the scroll-listener and+ * resize-observer that toggle .is-visible on the nav buttons.+ * --------------------------------------------------------------------- */++.tabs-scroller {+ position: relative;+ display: flex;+ align-items: stretch;+ border-bottom: var(--border-hairline) solid var(--border-primary);+}++.tabs-scroller > .tabs {+ flex: 1;+ border-bottom: none;+ overflow-x: auto;+ scrollbar-width: none; /* Firefox */+ -ms-overflow-style: none; /* IE 10+ */+}+.tabs-scroller > .tabs::-webkit-scrollbar {+ display: none; /* Chromium / Safari */+}++.tabs-scroller__nav {+ position: absolute;+ top: 0;+ bottom: 0;+ width: 36px;+ z-index: 2;+ display: none; /* shown by .is-visible */+ align-items: center;+ justify-content: center;+ background: transparent;+ border: none;+ color: var(--text-muted);+ cursor: pointer;+ transition: color var(--t-fast) ease, opacity var(--t-fast) ease;+ pointer-events: auto;+}+.tabs-scroller__nav:hover { color: var(--text-primary); }+.tabs-scroller__nav.is-visible { display: inline-flex; }++.tabs-scroller__nav--left { left: 0; background: linear-gradient(to right, var(--bg-secondary) 60%, transparent 100%); }+.tabs-scroller__nav--right { right: 0; background: linear-gradient(to left, var(--bg-secondary) 60%, transparent 100%); }+++/* ---- Toggle (binary on/off pill) ---------------------------------------- */.toggle {diff --git a/templates/account.html b/templates/account.htmlindex 9774f75c..de1db866 100644--- a/templates/account.html+++ b/templates/account.html@@ -403,9 +403,16 @@same surface as the main app. Tab strip below is theprimary navigation; content scrolls inside. --><div class="flex flex-col flex-grow overflow-hidden">- <!-- Tab strip using the .tabs primitive. IDs preserved so+ <!-- Tab strip using the .tabs primitive, wrapped in+ .tabs-scroller so long strips get left/right chevron+ buttons that appear when scrollable; wheel-over-tabs+ also maps to horizontal scroll. IDs preserved soexisting tab-switching JS keeps working unchanged. -->- <nav class="tabs px-3 sm:px-4 overflow-x-auto scrollbar-hide flex-shrink-0" aria-label="Tabs" id="tabs-container">+ <div class="tabs-scroller flex-shrink-0" data-tabs-scroller>+ <button type="button" class="tabs-scroller__nav tabs-scroller__nav--left" aria-label="Scroll left">+ <i class="fas fa-chevron-left"></i>+ </button>+ <nav class="tabs px-3 sm:px-4" aria-label="Tabs" id="tabs-container"><a href="#" id="tab-account" class="tab is-active"><i class="fas fa-user-circle"></i><span data-i18n="account.title">Account</span></a>@@ -440,6 +447,10 @@<i class="fas fa-info-circle"></i><span data-i18n="accountTabs.about">About</span></a></nav>+ <button type="button" class="tabs-scroller__nav tabs-scroller__nav--right" aria-label="Scroll right">+ <i class="fas fa-chevron-right"></i>+ </button>+ </div><div class="tab-content-wrapper px-4 sm:px-6 lg:px-8 pb-4 sm:pb-6 lg:pb-8"><div id="content-account" class="tab-content pt-6">@@ -4088,11 +4099,16 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</co}}- // Toggle dark mode+ // Toggle dark mode. Re-applies the saved color scheme so the+ // mode-prefix (theme-light-* vs theme-dark-*) flips along with+ // the dark class — otherwise switching from dark→light leaves+ // the previous theme-dark-{amber|emerald|etc.} class on+ // documentElement and the page falls back to the default blue+ // light palette because no theme-light-* class was added.darkModeToggle.addEventListener('click', () => {const isDarkMode = document.documentElement.classList.toggle('dark');localStorage.setItem('darkMode', isDarkMode);-+if (isDarkMode) {darkModeIcon.classList.remove('fa-moon');darkModeIcon.classList.add('fa-sun');@@ -4100,6 +4116,11 @@ curl "https://your-speakr-instance.com/api/recordings?token=YOUR_TOKEN_HERE"</codarkModeIcon.classList.remove('fa-sun');darkModeIcon.classList.add('fa-moon');}++ // Re-apply the color scheme for the new mode.+ if (typeof applyTheme === 'function') {+ applyTheme();+ }});// User dropdown functionalitydiff --git a/templates/components/page-header.html b/templates/components/page-header.htmlindex d4ac250d..68f63cbd 100644--- a/templates/components/page-header.html+++ b/templates/components/page-header.html@@ -72,4 +72,65 @@ document.addEventListener('click', function(e) {dd.classList.add('hidden');}});++// Tabs scroller — attaches to any element marked [data-tabs-scroller]+// that wraps a .tabs container. Shows/hides left/right chevron buttons+// based on whether the tab strip can scroll further in that direction;+// click scrolls by 240px; wheel-over-tabs maps vertical wheel to+// horizontal scroll. Idempotent on multiple init calls.+(function () {+ function initScroller(root) {+ if (root.dataset.tabsScrollerInit === '1') return;+ root.dataset.tabsScrollerInit = '1';+ var tabs = root.querySelector('.tabs');+ var left = root.querySelector('.tabs-scroller__nav--left');+ var right = root.querySelector('.tabs-scroller__nav--right');+ if (!tabs || !left || !right) return;++ function update() {+ var maxScroll = tabs.scrollWidth - tabs.clientWidth;+ left.classList.toggle('is-visible', tabs.scrollLeft > 4);+ right.classList.toggle('is-visible', tabs.scrollLeft < maxScroll - 4);+ }++ left.addEventListener('click', function () {+ tabs.scrollBy({ left: -240, behavior: 'smooth' });+ });+ right.addEventListener('click', function () {+ tabs.scrollBy({ left: 240, behavior: 'smooth' });+ });+ tabs.addEventListener('scroll', update, { passive: true });++ // Wheel-over-tabs: map vertical wheel to horizontal scroll so+ // users can flick through the strip without using the buttons.+ tabs.addEventListener('wheel', function (e) {+ // Only intercept if the dominant axis is vertical and+ // there's somewhere horizontal to go.+ if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) return;+ var maxScroll = tabs.scrollWidth - tabs.clientWidth;+ if (maxScroll <= 0) return;+ if ((e.deltaY > 0 && tabs.scrollLeft >= maxScroll) ||+ (e.deltaY < 0 && tabs.scrollLeft <= 0)) return;+ e.preventDefault();+ tabs.scrollLeft += e.deltaY;+ }, { passive: false });++ if (window.ResizeObserver) {+ new ResizeObserver(update).observe(tabs);+ } else {+ window.addEventListener('resize', update);+ }+ // Initial measure.+ requestAnimationFrame(update);+ }++ function initAll() {+ document.querySelectorAll('[data-tabs-scroller]').forEach(initScroller);+ }+ if (document.readyState === 'loading') {+ document.addEventListener('DOMContentLoaded', initAll);+ } else {+ initAll();+ }+})();</script>