diff --git a/Foxnouns.Frontend/src/lib/pageUtils.svelte.ts b/Foxnouns.Frontend/src/lib/pageUtils.svelte.ts new file mode 100644 index 0000000..5f45815 --- /dev/null +++ b/Foxnouns.Frontend/src/lib/pageUtils.svelte.ts @@ -0,0 +1,10 @@ +import { page } from "$app/state"; + +export const isActive = (path: string | string[], prefix: boolean = false) => + typeof path === "string" + ? prefix + ? 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); diff --git a/Foxnouns.Frontend/src/routes/settings/+layout.svelte b/Foxnouns.Frontend/src/routes/settings/+layout.svelte index 11801cf..8f18c8e 100644 --- a/Foxnouns.Frontend/src/routes/settings/+layout.svelte +++ b/Foxnouns.Frontend/src/routes/settings/+layout.svelte @@ -1,20 +1,11 @@ diff --git a/Foxnouns.Frontend/src/routes/settings/members/[id]/+layout@.svelte b/Foxnouns.Frontend/src/routes/settings/members/[id]/+layout@.svelte index faae426..f3f4301 100644 --- a/Foxnouns.Frontend/src/routes/settings/members/[id]/+layout@.svelte +++ b/Foxnouns.Frontend/src/routes/settings/members/[id]/+layout@.svelte @@ -1,14 +1,12 @@