2024-07-08 11:44:39 -04:00
|
|
|
<script lang="ts">
|
|
|
|
import { goto } from '$app/navigation';
|
|
|
|
|
|
|
|
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">
|
|
|
|
<div class="bg-neutral text-neutral-content rounded-full w-10 ml-4">
|
|
|
|
{#if user.profile_pic}
|
2024-07-08 15:23:31 -04:00
|
|
|
<img src={user.profile_pic} alt="User 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"
|
|
|
|
class="dropdown-content z-[1] menu p-2 shadow bg-primary-content mt-2 rounded-box w-52"
|
|
|
|
>
|
|
|
|
<!-- svelte-ignore a11y-missing-attribute -->
|
|
|
|
<!-- svelte-ignore a11y-missing-attribute -->
|
|
|
|
<p class="text-lg ml-4 font-bold">Hi, {user.first_name} {user.last_name}</p>
|
|
|
|
<li><button on:click={() => goto('/profile')}>Profile</button></li>
|
|
|
|
<li><button on:click={() => goto('/visited')}>My Log</button></li>
|
|
|
|
<li><button on:click={() => goto('/settings')}>User Settings</button></li>
|
|
|
|
<form method="post">
|
|
|
|
<li><button formaction="/?/logout">Logout</button></li>
|
|
|
|
</form>
|
|
|
|
</ul>
|
|
|
|
</div>
|