diff options
Diffstat (limited to 'src/routes')
| -rw-r--r-- | src/routes/+layout.svelte | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 61d425f2..dfb3a278 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -125,9 +125,32 @@ <span class="header-item opaque separator">•</span> {#if data.user} - <a href={root(`/user/${$userIdentity.name}`)} class="header-item"> - {$locale().navigation.profile} - </a> + <Dropdown + items={[ + { name: $locale().navigation.myProfile, url: root(`/user/${$userIdentity.name}`) }, + { + name: $locale().navigation.myBadgeWall, + url: root(`/user/${$userIdentity.name}/badges`) + }, + { + name: $locale().navigation.logOut, + url: '#', + onClick: () => { + localStorage.removeItem('identity'); + localStorage.removeItem('commit'); + + document.cookie = 'user=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; + + window.location.href = root('/api/authentication/log-out'); + } + } + ]} + header={false} + > + <span slot="title" class="header-item"> + {$locale().navigation.profile} + </span> + </Dropdown> {/if} {#if data.user === undefined} @@ -143,26 +166,10 @@ > {$locale().navigation.logIn} </a> - {:else} - <a - href={'#'} - class="header-item" - on:click={() => { - localStorage.removeItem('identity'); - localStorage.removeItem('commit'); - - document.cookie = 'user=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; - - window.location.href = root('/api/authentication/log-out'); - }} - > - {$locale().navigation.logOut} + {:else if data.user} + <a href={root(`/user/${$userIdentity.name}`)} class="header-item"> + <img id="avatar" src={$userIdentity.avatar} alt="Avatar" /> </a> - {#if data.user} - <a href={root(`/user/${$userIdentity.name}`)} class="header-item"> - <img id="avatar" src={$userIdentity.avatar} alt="Avatar" /> - </a> - {/if} {/if} </div> </div> |