1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-19 21:09:37 +02:00
AdventureLog/frontend/src/lib/components/Avatar.svelte

42 lines
1.4 KiB
Svelte
Raw Normal View History

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">
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-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"
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 -->
<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>
2024-07-13 10:28:45 -04:00
<li><button on:click={() => goto('/adventures')}>My Adventures</button></li>
2024-07-17 22:06:55 -04:00
<li><button on:click={() => goto('/activities')}>My Activities</button></li>
2024-09-09 13:44:42 -04:00
<li><button on:click={() => goto('/shared')}>Shared With Me</button></li>
2024-07-08 11:44:39 -04:00
<li><button on:click={() => goto('/settings')}>User Settings</button></li>
<form method="post">
<li><button formaction="/?/logout">Logout</button></li>
</form>
</ul>
</div>