refactor(frontend): deduplicate isActive function

This commit is contained in:
sam 2024-12-26 14:10:03 -05:00
parent 5077bd6a0b
commit 49e9eabea0
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
4 changed files with 13 additions and 16 deletions

View file

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