Weblah/src/routes/(app)/CurrentAccountIndicator.svelte
Shibo Lyu 924427a810 refactor: Account management and settings navigation
Move profile page to /settings/account/profile and replace
CurrentAccountPicture with CurrentAccountIndicator component
using the new account manager pattern. Update identity type
to accept null instead of undefined.
2025-04-14 01:33:24 +08:00

19 lines
658 B
Svelte

<script lang="ts">
import manager from '$lib/accounts/manager.svelte';
import ProfilePicture from '$lib/components/ProfilePicture.svelte';
import { tw } from '$lib/tw';
import type { HTMLAttributes } from 'svelte/elements';
interface Props extends HTMLAttributes<HTMLAnchorElement> {
class?: string;
}
const { class: classNames, ...rest }: Props = $props();
const currentAccount = $derived(manager.currentAccount);
const href = $derived(currentAccount ? '/settings/account/profile' : '/settings/account/add');
</script>
<a {href} class={tw('cursor-default', classNames)} {...rest}>
<ProfilePicture identity={currentAccount} size={32} />
</a>