mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-29 09:49:38 +02:00
Add UserAvatar component and update Navbar.svelte
This commit is contained in:
parent
cd11ce2d97
commit
de2dd6cd7e
3 changed files with 16 additions and 6 deletions
|
@ -4,6 +4,7 @@
|
|||
import { goto } from "$app/navigation";
|
||||
import type { DatabaseUser } from "$lib/server/auth";
|
||||
export let user: any;
|
||||
import UserAvatar from "./UserAvatar.svelte";
|
||||
async function goHome() {
|
||||
goto("/");
|
||||
}
|
||||
|
@ -16,6 +17,9 @@
|
|||
async function toToLogin() {
|
||||
goto("/login");
|
||||
}
|
||||
async function toToSignup() {
|
||||
goto("/signup");
|
||||
}
|
||||
|
||||
let count = 0;
|
||||
visitCount.subscribe((value) => {
|
||||
|
@ -54,8 +58,10 @@
|
|||
<p>Adventures: {count}</p>
|
||||
{#if !user}
|
||||
<button class="btn btn-primary ml-4" on:click={toToLogin}>Login</button>
|
||||
<button class="btn btn-primary ml-4" on:click={toToSignup}>Signup</button>
|
||||
{/if}
|
||||
{#if user}
|
||||
<UserAvatar {user} />
|
||||
<form method="post" use:enhance>
|
||||
<button class="btn btn-primary ml-4">Sign out</button>
|
||||
</form>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue