From 212d587f97886476c717f54b12ac821573834ac8 Mon Sep 17 00:00:00 2001 From: Andrew S Erwin Date: Tue, 17 Nov 2026 11:08:10 -0600 Subject: [PATCH] Settings: grouped vertical navigation replaces the overflowing flat tab strip The 12 settings sat in a flat horizontal tab strip inside a narrow max-w-2xl container, so roughly half (MCP, WebDAV, CalDAV, CardDAV, OIDC) hid behind a horizontal scrollbar on desktop AND mobile, with no logical grouping. Replaced with a grouped vertical settings nav: - Account: Profile, Sign-in - Connections: WebDAV, CalDAV, CardDAV, Contacts sync, IMAP - AI & Automation: AI, MCP, Automations, Notifications - Developer: API Keys Desktop shows the nav beside the content pane (page widened to max-w-5xl); below md it becomes a list -> detail flow with an "All settings" back button, the same master-detail pattern as collections/tags/contacts. Built on Radix Tabs with orientation="vertical" and controlled value, so role="tab" locators, deep links and keyboard navigation are preserved; group headers are non-focusable fragments inside the list. Clarified two jargon labels: OIDC -> "Sign-in" (content header "Sign-in (OIDC)") and Nextcloud -> "Contacts sync" (header "Contacts sync (Nextcloud)"), distinguishing the legacy contact import from the CardDAV collection connector. All 12 content panels preserved verbatim. Verified: regressions 20/20 (incl. the three DAV settings walkthroughs and the mobile settings test, now exercising the grouped nav), real-stack e2e all pass, lint/SSR-lint/build 0 errors; before/after screenshots at 1280px and 390px confirm the full grouped nav and the mobile master-detail flow. --- scripts/regressions.mjs | 2 +- web/app/(app)/settings/client.tsx | 243 ++++++++++++++++++------------ 2 files changed, 146 insertions(+), 99 deletions(-) diff --git a/scripts/regressions.mjs b/scripts/regressions.mjs index 7ad9d6b..bd1c478 100644 --- a/scripts/regressions.mjs +++ b/scripts/regressions.mjs @@ -828,7 +828,7 @@ try { await noOverflow(path) } await mobileContext.close() - console.log('PASS: mobile shell — drawer nav, bookmark cards, master-detail rails, scrollable settings tabs, no horizontal overflow on any screen') + console.log('PASS: mobile shell — drawer nav, bookmark cards, master-detail rails, grouped settings nav, no horizontal overflow on any screen') // Revocation failure path (review CR-02): when Go's revocation fails, the // local sign-out still completes, but the UI must say so — local cookie diff --git a/web/app/(app)/settings/client.tsx b/web/app/(app)/settings/client.tsx index 1e26981..9b66cb2 100644 --- a/web/app/(app)/settings/client.tsx +++ b/web/app/(app)/settings/client.tsx @@ -1,11 +1,11 @@ 'use client' -import { useState, useEffect, useCallback } from 'react' +import { useState, useEffect, useCallback, Fragment } from 'react' import { useSession } from 'next-auth/react' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs' -import { User, Mail, Server, Cloud, Shield, Bell, Sparkles, Bot, KeyRound, PlugZap, FolderSync, CalendarDays, BookUser, Check, X, AlertTriangle } from 'lucide-react' +import { User, Mail, Server, Cloud, Shield, Bell, Sparkles, Bot, KeyRound, PlugZap, FolderSync, CalendarDays, BookUser, ArrowLeft, Check, X, AlertTriangle } from 'lucide-react' import { toast } from 'sonner' import { invalidateReference } from '@/lib/reference-data' import { NotificationsSettings } from '@/components/notifications-settings' @@ -17,6 +17,36 @@ import { WebdavSettings } from '@/components/webdav-settings' import { CalDavSettings } from '@/components/caldav-settings' import { CardDavSettings } from '@/components/carddav-settings' import type { OidcStatus } from '@/lib/oidc-config' +import { cn } from '@/lib/utils' +import { useMediaQuery } from '@/lib/use-media-query' + + +// Settings are grouped by purpose, not a flat strip: account, the external +// services that feed your data, the assistant/automation surface, and +// machine/developer access. Each item keeps its Radix tab value so deep +// links and the browser suites' role="tab" locators are unchanged. +const NAV_GROUPS = [ + { label: 'Account', items: [ + { value: 'profile', label: 'Profile', icon: User }, + { value: 'oidc', label: 'Sign-in', icon: Shield }, + ] }, + { label: 'Connections', items: [ + { value: 'webdav', label: 'WebDAV', icon: FolderSync }, + { value: 'caldav', label: 'CalDAV', icon: CalendarDays }, + { value: 'carddav', label: 'CardDAV', icon: BookUser }, + { value: 'nextcloud', label: 'Contacts sync', icon: Cloud }, + { value: 'imap', label: 'IMAP', icon: Mail }, + ] }, + { label: 'AI & Automation', items: [ + { value: 'ai', label: 'AI', icon: Bot }, + { value: 'mcp', label: 'MCP', icon: PlugZap }, + { value: 'automations', label: 'Automations', icon: Sparkles }, + { value: 'notifications', label: 'Notifications', icon: Bell }, + ] }, + { label: 'Developer', items: [ + { value: 'api-keys', label: 'API Keys', icon: KeyRound }, + ] }, +] export function SettingsClient({ oidc, callbackUrl }: { oidc: OidcStatus; callbackUrl: string }) { const { data: session } = useSession() @@ -25,6 +55,12 @@ export function SettingsClient({ oidc, callbackUrl }: { oidc: OidcStatus; callba const [savingImap, setSavingImap] = useState(false) const [testingImap, setTestingImap] = useState(false) const [syncingContacts, setSyncingContacts] = useState(false) + const [section, setSection] = useState('profile') + // Below md the grouped nav becomes a list -> detail flow (same + // master-detail pattern as collections/tags/contacts); at md+ the + // nav and the selected panel sit side by side. + const isNarrow = useMediaQuery('(max-width: 767px)') + const [mobileDetail, setMobileDetail] = useState(false) useEffect(() => { fetch('/api/settings/imap').then(r => r.json()).then(data => { @@ -92,29 +128,49 @@ export function SettingsClient({ oidc, callbackUrl }: { oidc: OidcStatus; callba } return ( -
+

Settings

Configure your integrations and preferences

- - - Profile - IMAP - Nextcloud - Notifications - Automations - AI - API Keys - MCP - WebDAV - CalDAV - CardDAV - OIDC - + { setSection(v); if (isNarrow) setMobileDetail(true) }} + orientation="vertical" + className="w-full" + > +
+ + {NAV_GROUPS.map((g) => ( + +
{g.label}
+ {g.items.map((it) => ( + + {it.label} + + ))} +
+ ))} +
- +
+ {isNarrow && mobileDetail && ( + + )} +
{(session?.user?.name ?? session?.user?.email ?? '?')[0]?.toUpperCase()} @@ -125,8 +181,67 @@ export function SettingsClient({ oidc, callbackUrl }: { oidc: OidcStatus; callba
- - + +
+

Sign-in (OIDC)

+

Authelia single sign-on, configured via environment variables (read-only)

+
+ {oidc.enabled ? : } + + {oidc.enabled + ? <>Configured for {oidc.issuer}. Authelia sign-in is enabled. + : <>Not connected. Authelia sign-in is disabled until all three variables below hold real values. Users can sign in with email and password meanwhile. Setup guide: docs/AUTHELIA.md} + +
+
+ {([['OIDC_ISSUER', oidc.issuerSet], ['OIDC_CLIENT_ID', oidc.clientIdSet], ['OIDC_CLIENT_SECRET', oidc.clientSecretSet]] as const).map(([name, set]) => ( +
+ {name} + {set ? 'Set' : 'Not set'} + {set ? : } +
+ ))} +
+
+

Redirect URI to register in Authelia

+

{callbackUrl}

+
+
+
+ + + + + + + + + + +
+

Contacts sync (Nextcloud)

+
+
+ + ) => setNcConfig(p => ({ ...p, nextcloudUrl: e.target.value }))} placeholder="https://nextcloud.example.com" /> +
+
+ + ) => setNcConfig(p => ({ ...p, cardDavPath: e.target.value }))} placeholder="/remote.php/dav/addressbooks/users/USER/contacts/" /> +
+
+ + ) => setNcConfig(p => ({ ...p, username: e.target.value }))} /> +
+
+ + ) => setNcConfig(p => ({ ...p, password: e.target.value }))} /> +
+
+ +
+
+

IMAP Configuration

@@ -162,91 +277,23 @@ export function SettingsClient({ oidc, callbackUrl }: { oidc: OidcStatus; callba
- - -
-

Nextcloud / CardDAV

-
-
- - ) => setNcConfig(p => ({ ...p, nextcloudUrl: e.target.value }))} placeholder="https://nextcloud.example.com" /> -
-
- - ) => setNcConfig(p => ({ ...p, cardDavPath: e.target.value }))} placeholder="/remote.php/dav/addressbooks/users/USER/contacts/" /> -
-
- - ) => setNcConfig(p => ({ ...p, username: e.target.value }))} /> -
-
- - ) => setNcConfig(p => ({ ...p, password: e.target.value }))} /> -
-
- -
-
- - - - - - - - - - + - - - - - - + - - - + + - - - + + - - - + + - - -
-

OIDC Configuration

-

Authelia single sign-on, configured via environment variables (read-only)

-
- {oidc.enabled ? : } - - {oidc.enabled - ? <>Configured for {oidc.issuer}. Authelia sign-in is enabled. - : <>Not connected. Authelia sign-in is disabled until all three variables below hold real values. Users can sign in with email and password meanwhile. Setup guide: docs/AUTHELIA.md} - -
-
- {([['OIDC_ISSUER', oidc.issuerSet], ['OIDC_CLIENT_ID', oidc.clientIdSet], ['OIDC_CLIENT_SECRET', oidc.clientSecretSet]] as const).map(([name, set]) => ( -
- {name} - {set ? 'Set' : 'Not set'} - {set ? : } -
- ))} -
-
-

Redirect URI to register in Authelia

-

{callbackUrl}

-
-
+
)