From 3d7ca1a82a5b507e48bb22476f8da74d6a6860d8 Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Sat, 22 Aug 2026 09:55:31 +0200 Subject: [PATCH] refactor(ui): remove settings route and URL-based settings navigation --- .../ui/src/lib/constants/routes.constants.ts | 4 -- .../hooks/use-settings-navigation.svelte.ts | 45 ------------------- tools/ui/src/lib/services/index.ts | 1 - tools/ui/src/lib/services/router.service.ts | 7 +-- tools/ui/src/lib/stores/index.ts | 2 - .../lib/stores/settings/referrer.svelte.ts | 19 -------- tools/ui/src/routes/settings/+layout.svelte | 38 ---------------- .../routes/settings/[[section]]/+page.svelte | 15 ------- 8 files changed, 1 insertion(+), 130 deletions(-) delete mode 100644 tools/ui/src/lib/hooks/use-settings-navigation.svelte.ts delete mode 100644 tools/ui/src/lib/stores/settings/referrer.svelte.ts delete mode 100644 tools/ui/src/routes/settings/+layout.svelte delete mode 100644 tools/ui/src/routes/settings/[[section]]/+page.svelte diff --git a/tools/ui/src/lib/constants/routes.constants.ts b/tools/ui/src/lib/constants/routes.constants.ts index d46acfd780..1f518a7586 100644 --- a/tools/ui/src/lib/constants/routes.constants.ts +++ b/tools/ui/src/lib/constants/routes.constants.ts @@ -15,10 +15,6 @@ export const ROUTES = { MCP_SERVERS: '#/mcp-servers', /** Search — mobile-only full-page conversation search. */ SEARCH: '#/search', - /** Settings base — for dynamic settings URLs use RouterService. */ - SETTINGS: '#/settings', - /** Exit destination for the settings view (fallback when no referrer). */ - SETTINGS_EXIT: '#/', /** Root — start of the app. */ START: '#/' } as const; diff --git a/tools/ui/src/lib/hooks/use-settings-navigation.svelte.ts b/tools/ui/src/lib/hooks/use-settings-navigation.svelte.ts deleted file mode 100644 index b1b0456a83..0000000000 --- a/tools/ui/src/lib/hooks/use-settings-navigation.svelte.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { beforeNavigate } from '$app/navigation'; -import { page } from '$app/state'; -import { ROUTES } from '$lib/constants'; -import { settingsReferrer } from '$lib/stores'; - -export interface ChatSettings { - reset: () => void; -} - -export function useSettingsNavigation() { - const subroute = $state({ - activePanel: 'chat' as 'chat' | 'settings' | 'mcp', - chatSettingsRef: undefined as ChatSettings | undefined - }); - const isSettingsRoute = $derived(!!page.route.id?.startsWith('/settings')); - - beforeNavigate(({ from, to }) => { - if (to?.route?.id?.startsWith('/settings') && !from?.route?.id?.startsWith('/settings')) { - settingsReferrer.url = window.location.hash || ROUTES.START; - } - }); - - $effect(() => { - if (subroute.activePanel === 'settings' && subroute.chatSettingsRef) { - subroute.chatSettingsRef.reset(); - } - }); - - // Return to chat when navigating to a new route - $effect(() => { - void page.url; - - subroute.activePanel = 'chat'; - }); - - return { - get isSettingsRoute() { - return isSettingsRoute; - }, - - get panel() { - return subroute; - } - }; -} diff --git a/tools/ui/src/lib/services/index.ts b/tools/ui/src/lib/services/index.ts index 3175005660..cfd0077acc 100644 --- a/tools/ui/src/lib/services/index.ts +++ b/tools/ui/src/lib/services/index.ts @@ -307,7 +307,6 @@ export { SandboxService } from './sandbox.service'; * * **Key Responsibilities:** * - Build chat URLs for specific conversations: `RouterService.chat(id)` → `#/chat/:id` - * - Build settings URLs for sections: `RouterService.settings(section)` → `#/settings/:section` * * @see ROUTES in constants/routes.ts — static route base paths */ diff --git a/tools/ui/src/lib/services/router.service.ts b/tools/ui/src/lib/services/router.service.ts index 217de38f3a..a16731d6db 100644 --- a/tools/ui/src/lib/services/router.service.ts +++ b/tools/ui/src/lib/services/router.service.ts @@ -1,8 +1,7 @@ /** * RouterService - Builds app route paths * - * Returns chat and settings route strings from a single source of truth - * (ROUTES). No state. + * Returns chat route strings from a single source of truth (ROUTES). No state. */ import { ROUTES } from '$lib/constants'; @@ -11,8 +10,4 @@ export class RouterService { static chat(id: string): string { return `${ROUTES.CHAT}/${id}`; } - - static settings(section: string): string { - return `${ROUTES.SETTINGS}/${section}`; - } } diff --git a/tools/ui/src/lib/stores/index.ts b/tools/ui/src/lib/stores/index.ts index 40ddd10bfd..b571699072 100644 --- a/tools/ui/src/lib/stores/index.ts +++ b/tools/ui/src/lib/stores/index.ts @@ -49,8 +49,6 @@ export { uiStore } from './ui.svelte'; // SETTINGS / UI PREFERENCES export { settingsStore } from './settings/index.svelte'; -export { settingsReferrer } from './settings/referrer.svelte'; - export { permissionsStore } from './permissions.svelte'; // TOOLS diff --git a/tools/ui/src/lib/stores/settings/referrer.svelte.ts b/tools/ui/src/lib/stores/settings/referrer.svelte.ts deleted file mode 100644 index d1055cc6e8..0000000000 --- a/tools/ui/src/lib/stores/settings/referrer.svelte.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * settingsReferrer - Remembers the settings route to return to after exit - * - * Tracks the last settings section the user was on so the app can return - * there after a fallback exit. Standalone reactive value, no host. - */ - -import { ROUTES } from '$lib/constants'; - -let _url = $state(ROUTES.SETTINGS_EXIT); - -export const settingsReferrer = { - get url() { - return _url; - }, - set url(value: string) { - _url = value; - } -}; diff --git a/tools/ui/src/routes/settings/+layout.svelte b/tools/ui/src/routes/settings/+layout.svelte deleted file mode 100644 index 1eeb10772a..0000000000 --- a/tools/ui/src/routes/settings/+layout.svelte +++ /dev/null @@ -1,38 +0,0 @@ - - -
- -
- -
- {@render children?.()} -
diff --git a/tools/ui/src/routes/settings/[[section]]/+page.svelte b/tools/ui/src/routes/settings/[[section]]/+page.svelte deleted file mode 100644 index d4faae0449..0000000000 --- a/tools/ui/src/routes/settings/[[section]]/+page.svelte +++ /dev/null @@ -1,15 +0,0 @@ - - -).section} />