diff --git a/web/src/components/sidebar/Sidebar.svelte b/web/src/components/sidebar/Sidebar.svelte
index 9faf1e21..838240e1 100644
--- a/web/src/components/sidebar/Sidebar.svelte
+++ b/web/src/components/sidebar/Sidebar.svelte
@@ -1,6 +1,6 @@
diff --git a/web/src/components/subnav/PageNav.svelte b/web/src/components/subnav/PageNav.svelte
index 72d55627..eec10971 100644
--- a/web/src/components/subnav/PageNav.svelte
+++ b/web/src/components/subnav/PageNav.svelte
@@ -2,14 +2,14 @@
import { page } from "$app/stores";
import { goto } from "$app/navigation";
import { browser } from "$app/environment";
+ import { defaultNavPage } from "$lib/subnav";
import { t } from "$lib/i18n/translations";
import IconArrowLeft from "@tabler/icons-svelte/IconArrowLeft.svelte";
- export let pageName: string;
+ export let pageName: "settings" | "about";
export let homeNavPath: string;
- export let homeDesktopPath: string;
export let homeTitle: string;
export let pageSubtitle = "";
export let contentPadding = false;
@@ -27,7 +27,7 @@
$: isHome = $page.url.pathname === homeNavPath;
$: {
if (browser && !isMobile && isHome) {
- goto(homeDesktopPath, { replaceState: true });
+ goto(defaultNavPage(pageName), { replaceState: true });
}
}
diff --git a/web/src/lib/subnav.ts b/web/src/lib/subnav.ts
index 0e6bbc6c..e6152310 100644
--- a/web/src/lib/subnav.ts
+++ b/web/src/lib/subnav.ts
@@ -1,26 +1,16 @@
import { browser } from "$app/environment";
-const defaultSettingsPage = () => {
- if (browser) {
- if (window.innerWidth <= 750) {
- return "/settings";
- }
+const defaultNavPage = (page: "settings" | "about") => {
+ if (browser && window.innerWidth <= 750) {
+ return `/${page}`;
}
- return "/settings/appearance";
-}
-
-const defaultAboutPage = () => {
- if (browser) {
- if (window.innerWidth <= 750) {
- return "/about";
- }
+ switch (page) {
+ case "settings":
+ return "/settings/appearance";
+ case "about":
+ return "/about/general";
}
-
- return "/about/general";
}
-export {
- defaultSettingsPage,
- defaultAboutPage
-}
+export { defaultNavPage };
diff --git a/web/src/routes/+error.svelte b/web/src/routes/+error.svelte
index 69c42e58..0a38d00d 100644
--- a/web/src/routes/+error.svelte
+++ b/web/src/routes/+error.svelte
@@ -2,12 +2,12 @@
import { onMount } from "svelte";
import { page } from "$app/stores";
import { goto } from "$app/navigation";
- import { defaultSettingsPage } from "$lib/subnav";
+ import { defaultNavPage } from "$lib/subnav";
onMount(() => {
if ($page.error?.message === "Not Found") {
if ($page.url.pathname.startsWith("/settings")) {
- goto(defaultSettingsPage(), { replaceState: true });
+ goto(defaultNavPage("settings"), { replaceState: true });
} else {
goto("/", { replaceState: true });
}
diff --git a/web/src/routes/about/+layout.svelte b/web/src/routes/about/+layout.svelte
index c730fa9d..7c1b1709 100644
--- a/web/src/routes/about/+layout.svelte
+++ b/web/src/routes/about/+layout.svelte
@@ -1,6 +1,5 @@