Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/mrgnw/ananas. learn multiple languages at once ananas.xcc.es
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344<script> import { getContext } from 'svelte'; import { page } from '$app/stores'; // Get user store from context const userStore = getContext('user'); // Access auth state reactively with Svelte 5 syntax const isAuthenticated = $derived(userStore.user.auth.isAuthenticated); const username = $derived(userStore.user.auth.username);</script>
{#if isAuthenticated} <li> <a href="/user" class:active={$page.url.pathname.startsWith('/user')} class="user-profile-link"> {#if username} {username} {:else} Profile {/if} </a> </li>{:else} <li><a href="/auth/login" class:active={$page.url.pathname.startsWith('/auth/login')}>Login</a></li> <li><a href="/auth/signup" class:active={$page.url.pathname.startsWith('/auth/signup')}>Signup</a></li>{/if}
<style> .user-profile-link { font-weight: 500; display: flex; align-items: center; gap: 0.5rem; } .user-profile-link::before { content: ''; display: inline-block; width: 0.6rem; height: 0.6rem; background-color: #10b981; border-radius: 50%; }</style>