diff --git a/web/components/settings/SettingsMain.tsx b/web/components/settings/SettingsMain.tsx index 609e3b19a..542ca297b 100644 --- a/web/components/settings/SettingsMain.tsx +++ b/web/components/settings/SettingsMain.tsx @@ -72,11 +72,26 @@ export default function SettingsMain({ children }: { children: React.ReactNode } + ) + // The 224px rail has no room for "Settings" and a labelled back button side + // by side once a locale spells both long ("Einstellungen" / "Zurück zur + // App"), so the rail keeps the title and gives the exit an icon with a + // tooltip. The phone header has the width and keeps the label. + const railReturnButton = ( + ) @@ -86,7 +101,7 @@ export default function SettingsMain({ children }: { children: React.ReactNode } // its own rounded edge, so opening settings no longer replaces the whole // window. Phones have no room for a floating card and get the full sheet.
{ // Clicking the scrim behaves like Escape: leave settings, but never @@ -99,11 +114,11 @@ export default function SettingsMain({ children }: { children: React.ReactNode } className="flex h-dvh w-full min-w-0 flex-col overflow-hidden bg-[var(--background)] md:h-[min(820px,88dvh)] md:w-[min(1080px,94vw)] md:rounded-2xl md:border md:border-[color-mix(in_srgb,var(--border)_70%,transparent)] md:shadow-[0_28px_70px_-32px_rgba(0,0,0,0.45)] lg:flex-row" > diff --git a/web/components/settings/SettingsNav.tsx b/web/components/settings/SettingsNav.tsx index 3d23fd7c8..c9331a9ab 100644 --- a/web/components/settings/SettingsNav.tsx +++ b/web/components/settings/SettingsNav.tsx @@ -1,6 +1,6 @@ 'use client' -import { useState } from 'react' +import { useEffect, useRef, useState } from 'react' import Link from 'next/link' import { usePathname } from 'next/navigation' import { Search, X } from 'lucide-react' @@ -26,9 +26,32 @@ export default function SettingsNav({ onNavigate }: { onNavigate?: () => void }) const access = useSettingsAccess() const pages = visibleSettingsPages(access) const [query, setQuery] = useState('') + const listRef = useRef(null) + const [moreBelow, setMoreBelow] = useState(false) const needle = query.trim().toLocaleLowerCase() const currentKey = pathname.split('/')[2] || 'general' const currentFamily = settingsPageFamily(currentKey) + + // The rail carries more sections than a 820px card can show (Search plus + // five groups runs past the viewport), so the list scrolls. Without a cue the + // last visible row is simply cut in half and reads as broken layout; the fade + // only appears while there is actually more to scroll to, and disappears at + // the end so the final row stays fully legible. + useEffect(() => { + const el = listRef.current + if (!el) return + const update = () => + setMoreBelow(el.scrollHeight - el.clientHeight - el.scrollTop > 8) + update() + el.addEventListener('scroll', update, { passive: true }) + const observer = + typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(update) + observer?.observe(el) + return () => { + el.removeEventListener('scroll', update) + observer?.disconnect() + } + }, [needle]) const matches = pages.filter(page => { const navLabel = settingsPageLabel(page.key, page.label) return [ @@ -90,43 +113,51 @@ export default function SettingsNav({ onNavigate }: { onNavigate?: () => void }) )}
-
- {groups - .filter(group => group.pages.length) - .map(group => ( -
-

- {t(group.label)} -

-
- {group.pages.map(page => { - const Icon = needle ? page.icon : settingsPageIcon(page.key, page.icon) - const active = needle ? page.key === currentKey : currentFamily.includes(page.key) - return ( - - - - - {t(needle ? page.label : settingsPageLabel(page.key, page.label))} - - - - ) - })} +
+
+ {groups + .filter(group => group.pages.length) + .map(group => ( +
+

+ {t(group.label)} +

+
+ {group.pages.map(page => { + const Icon = needle ? page.icon : settingsPageIcon(page.key, page.icon) + const active = needle ? page.key === currentKey : currentFamily.includes(page.key) + return ( + + + + + {t(needle ? page.label : settingsPageLabel(page.key, page.label))} + + + + ) + })} +
-
- ))} - {needle && !matches.length && ( -

- {t('No settings match “{{query}}”.', { query: query.trim() })} -

+ ))} + {needle && !matches.length && ( +

+ {t('No settings match “{{query}}”.', { query: query.trim() })} +

+ )} +
+ {moreBelow && ( +
)}