update sveltekit, migrate to $app/state
This commit is contained in:
parent
80385893c7
commit
397ffc2d5e
6 changed files with 141 additions and 141 deletions
|
@ -8,7 +8,7 @@
|
|||
NavLink,
|
||||
NavItem,
|
||||
} from "@sveltestrap/sveltestrap";
|
||||
import { page } from "$app/stores";
|
||||
import { page } from "$app/state";
|
||||
import type { Meta, MeUser } from "$api/models/index";
|
||||
import Logo from "$components/Logo.svelte";
|
||||
import { t } from "$lib/i18n";
|
||||
|
@ -51,19 +51,19 @@
|
|||
<NavItem>
|
||||
<NavLink
|
||||
href="/@{user.username}"
|
||||
active={$page.url.pathname.startsWith(`/@${user.username}`)}
|
||||
active={page.url.pathname.startsWith(`/@${user.username}`)}
|
||||
>
|
||||
@{user.username}
|
||||
</NavLink>
|
||||
</NavItem>
|
||||
<NavItem>
|
||||
<NavLink href="/settings" active={$page.url.pathname.startsWith("/settings")}>
|
||||
<NavLink href="/settings" active={page.url.pathname.startsWith("/settings")}>
|
||||
{$t("nav.settings")}
|
||||
</NavLink>
|
||||
</NavItem>
|
||||
{:else}
|
||||
<NavItem>
|
||||
<NavLink href="/auth/log-in" active={$page.url.pathname === "/auth/log-in"}>
|
||||
<NavLink href="/auth/log-in" active={page.url.pathname === "/auth/log-in"}>
|
||||
{$t("nav.log-in")}
|
||||
</NavLink>
|
||||
</NavItem>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue