mirror of
https://github.com/wukko/cobalt.git
synced 2025-06-12 21:27:39 +02:00
web: fix auto navigation on scale change for about & settings pages
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { t } from "$lib/i18n/translations";
|
||||
import { defaultSettingsPage } from "$lib/subnav";
|
||||
import { defaultNavPage } from "$lib/subnav";
|
||||
|
||||
import CobaltLogo from "$components/sidebar/CobaltLogo.svelte";
|
||||
import SidebarTab from "$components/sidebar/SidebarTab.svelte";
|
||||
@ -15,9 +15,9 @@
|
||||
import IconInfoCircle from "@tabler/icons-svelte/IconInfoCircle.svelte";
|
||||
|
||||
let screenWidth: number;
|
||||
let settingsLink = defaultSettingsPage();
|
||||
let settingsLink = defaultNavPage("settings");
|
||||
|
||||
$: screenWidth, settingsLink = defaultSettingsPage();
|
||||
$: screenWidth, settingsLink = defaultNavPage("settings");
|
||||
</script>
|
||||
|
||||
<svelte:window bind:innerWidth={screenWidth} />
|
||||
|
@ -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 });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user