update sveltekit, migrate to $app/state

This commit is contained in:
sam 2024-12-17 23:33:05 +01:00
parent 80385893c7
commit 397ffc2d5e
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
6 changed files with 141 additions and 141 deletions

View file

@ -1,6 +1,6 @@
<script lang="ts">
import type { Snippet } from "svelte";
import { page } from "$app/stores";
import { page } from "$app/state";
import { t } from "$lib/i18n";
import { Nav, NavLink } from "@sveltestrap/sveltestrap";
@ -10,11 +10,11 @@
const isActive = (path: string | string[], prefix: boolean = false) =>
typeof path === "string"
? prefix
? $page.url.pathname.startsWith(path)
: $page.url.pathname === path
? page.url.pathname.startsWith(path)
: page.url.pathname === path
: prefix
? path.some((p) => $page.url.pathname.startsWith(p))
: path.some((p) => $page.url.pathname === p);
? path.some((p) => page.url.pathname.startsWith(p))
: path.some((p) => page.url.pathname === p);
</script>
<svelte:head>

View file

@ -1,13 +1,13 @@
<script lang="ts">
import type { Snippet } from "svelte";
import { page } from "$app/stores";
import { page } from "$app/state";
import { t } from "$lib/i18n";
import type { LayoutData } from "./$types";
type Props = { data: LayoutData; children: Snippet };
let { data, children }: Props = $props();
const isActive = (path: string) => $page.url.pathname === path;
const isActive = (path: string) => page.url.pathname === path;
let name = $derived(
data.member.display_name === data.member.name

View file

@ -1,13 +1,13 @@
<script lang="ts">
import type { Snippet } from "svelte";
import { page } from "$app/stores";
import { page } from "$app/state";
import { t } from "$lib/i18n";
import type { LayoutData } from "./$types";
type Props = { data: LayoutData; children: Snippet };
let { data, children }: Props = $props();
const isActive = (path: string) => $page.url.pathname === path;
const isActive = (path: string) => page.url.pathname === path;
</script>
<svelte:head>