From f9f7dcc8eb86e58af04adacd797f6de69a8816b9 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 11 Feb 2024 12:35:56 -0800 Subject: feat(layout): profile dropdown --- src/lib/Locale/english.ts | 4 +++- src/lib/Locale/japanese.ts | 4 +++- src/lib/Locale/layout.ts | 2 ++ src/routes/+layout.svelte | 51 ++++++++++++++++++++++++++-------------------- 4 files changed, 37 insertions(+), 24 deletions(-) diff --git a/src/lib/Locale/english.ts b/src/lib/Locale/english.ts index 24814f47..34052e21 100644 --- a/src/lib/Locale/english.ts +++ b/src/lib/Locale/english.ts @@ -14,7 +14,9 @@ const English: Locale = { logIn: 'Log in with AniList', logOut: 'Log out', schedule: 'Schedule', - hololive: 'hololive' + hololive: 'hololive', + myProfile: 'My Profile', + myBadgeWall: 'My Badge Wall' }, settings: { fields: { diff --git a/src/lib/Locale/japanese.ts b/src/lib/Locale/japanese.ts index 88d6f081..562b9fd5 100644 --- a/src/lib/Locale/japanese.ts +++ b/src/lib/Locale/japanese.ts @@ -14,7 +14,9 @@ const Japanese: Locale = { logIn: 'AniListでログインする', logOut: 'ログアウト', schedule: 'スケジュール', - hololive: 'ホロライブ' + hololive: 'ホロライブ', + myProfile: 'プロフィール', + myBadgeWall: 'バッジウォール' }, settings: { fields: { diff --git a/src/lib/Locale/layout.ts b/src/lib/Locale/layout.ts index 6194c4fc..5c32ceb3 100644 --- a/src/lib/Locale/layout.ts +++ b/src/lib/Locale/layout.ts @@ -17,6 +17,8 @@ export interface Locale { logOut: LocaleValue; schedule: LocaleValue; hololive: LocaleValue; + myProfile: LocaleValue; + myBadgeWall: LocaleValue; }; settings: { fields: { 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 @@ {#if data.user} - - {$locale().navigation.profile} - + { + 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} + > + + {$locale().navigation.profile} + + {/if} {#if data.user === undefined} @@ -143,26 +166,10 @@ > {$locale().navigation.logIn} - {:else} - { - 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} + + Avatar - {#if data.user} - - Avatar - - {/if} {/if} -- cgit v1.2.3