2024-07-08 11:44:39 -04:00
|
|
|
<script lang="ts">
|
|
|
|
import { goto } from '$app/navigation';
|
2024-10-26 23:03:35 -04:00
|
|
|
import { t } from 'svelte-i18n';
|
2024-07-08 11:44:39 -04:00
|
|
|
|
|
|
|
export let user: any;
|
|
|
|
|
|
|
|
let letter: string = user.first_name[0];
|
|
|
|
|
|
|
|
if (user && !user.first_name && user.username) {
|
|
|
|
letter = user.username[0];
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="dropdown dropdown-bottom dropdown-end" tabindex="0" role="button">
|
|
|
|
<div class="avatar placeholder">
|
2024-09-07 17:39:47 -04:00
|
|
|
<div class="bg-neutral rounded-full text-neutral-200 w-10 ml-4">
|
2024-07-08 11:44:39 -04:00
|
|
|
{#if user.profile_pic}
|
2024-10-28 13:56:57 -04:00
|
|
|
<img src={user.profile_pic} alt={$t('navbar.profile')} />
|
2024-07-08 11:44:39 -04:00
|
|
|
{:else}
|
|
|
|
<span class="text-2xl -mt-1">{letter}</span>
|
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- svelte-ignore a11y-missing-attribute -->
|
|
|
|
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
|
|
|
<ul
|
|
|
|
tabindex="0"
|
2024-09-07 17:39:47 -04:00
|
|
|
class="dropdown-content z-[1] text-neutral-200 menu p-2 shadow bg-neutral mt-2 rounded-box w-52"
|
2024-07-08 11:44:39 -04:00
|
|
|
>
|
|
|
|
<!-- svelte-ignore a11y-missing-attribute -->
|
|
|
|
<!-- svelte-ignore a11y-missing-attribute -->
|
2024-10-26 23:03:35 -04:00
|
|
|
<p class="text-lg ml-4 font-bold">
|
|
|
|
{$t('navbar.greeting')}, {user.first_name}
|
|
|
|
{user.last_name}
|
|
|
|
</p>
|
|
|
|
<li><button on:click={() => goto('/profile')}>{$t('navbar.profile')}</button></li>
|
|
|
|
<li><button on:click={() => goto('/adventures')}>{$t('navbar.my_adventures')}</button></li>
|
|
|
|
<li><button on:click={() => goto('/activities')}>{$t('navbar.my_activities')}</button></li>
|
|
|
|
<li><button on:click={() => goto('/shared')}>{$t('navbar.shared_with_me')}</button></li>
|
|
|
|
<li><button on:click={() => goto('/settings')}>{$t('navbar.settings')}</button></li>
|
2024-07-08 11:44:39 -04:00
|
|
|
<form method="post">
|
2024-10-26 23:03:35 -04:00
|
|
|
<li><button formaction="/?/logout">{$t('navbar.logout')}</button></li>
|
2024-07-08 11:44:39 -04:00
|
|
|
</form>
|
|
|
|
</ul>
|
|
|
|
</div>
|