From 4efe1b9d2a485181de716b91d6648770dc33d0fe Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Sat, 15 Aug 2026 08:36:55 +0200 Subject: [PATCH] ui : move the settings exit route into ROUTES SETTINGS_FALLBACK_EXIT_ROUTE is just a route, so it lives with the other routes as ROUTES.SETTINGS_EXIT. --- tools/ui/src/lib/constants/routes.constants.ts | 2 ++ tools/ui/src/lib/constants/settings.constants.ts | 3 --- tools/ui/src/lib/stores/settings/referrer.svelte.ts | 4 ++-- tools/ui/src/routes/settings/+layout.svelte | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/ui/src/lib/constants/routes.constants.ts b/tools/ui/src/lib/constants/routes.constants.ts index 05d682f1d0..e4cce77399 100644 --- a/tools/ui/src/lib/constants/routes.constants.ts +++ b/tools/ui/src/lib/constants/routes.constants.ts @@ -21,6 +21,8 @@ export const ROUTES = { 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/constants/settings.constants.ts b/tools/ui/src/lib/constants/settings.constants.ts index f36e9b03ce..46c5a8dac4 100644 --- a/tools/ui/src/lib/constants/settings.constants.ts +++ b/tools/ui/src/lib/constants/settings.constants.ts @@ -717,9 +717,6 @@ export const SETTING_CONFIG_INFO: Record = Object.fromEntries( getAllSettings().map((s) => [s.key, s.help]) ) as Record; -/** Exit destination for the settings view (fallback when no referrer). */ -export const SETTINGS_FALLBACK_EXIT_ROUTE = ROUTES.START; - /** Sidebar sections + field configs (as consumed by UI). */ function toSettingsSection(section: SettingsSectionEntry): SettingsSection { return { diff --git a/tools/ui/src/lib/stores/settings/referrer.svelte.ts b/tools/ui/src/lib/stores/settings/referrer.svelte.ts index 9679049df9..d1055cc6e8 100644 --- a/tools/ui/src/lib/stores/settings/referrer.svelte.ts +++ b/tools/ui/src/lib/stores/settings/referrer.svelte.ts @@ -5,9 +5,9 @@ * there after a fallback exit. Standalone reactive value, no host. */ -import { SETTINGS_FALLBACK_EXIT_ROUTE } from '$lib/constants'; +import { ROUTES } from '$lib/constants'; -let _url = $state(SETTINGS_FALLBACK_EXIT_ROUTE); +let _url = $state(ROUTES.SETTINGS_EXIT); export const settingsReferrer = { get url() { diff --git a/tools/ui/src/routes/settings/+layout.svelte b/tools/ui/src/routes/settings/+layout.svelte index 4e191dce72..993d64d0b6 100644 --- a/tools/ui/src/routes/settings/+layout.svelte +++ b/tools/ui/src/routes/settings/+layout.svelte @@ -4,7 +4,7 @@ import { goto } from '$app/navigation'; import { page } from '$app/state'; import { ActionIcon } from '$lib/components/app'; - import { SETTINGS_FALLBACK_EXIT_ROUTE } from '$lib/constants'; + import { ROUTES } from '$lib/constants'; let { children } = $props(); @@ -24,7 +24,7 @@ if (browser && window.history.length > 1 && !prevIsSettings) { history.back(); } else { - goto(SETTINGS_FALLBACK_EXIT_ROUTE); + goto(ROUTES.SETTINGS_EXIT); } }