From dd062aff8d33bd24a287104a27e9357815bc64bf Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 3 Jan 2023 22:55:36 -0800 Subject: [PATCH 1/2] Fix language switch in logged-out menu --- types/GranblueCookie.d.ts | 4 ++-- utils/retrieveCookies.tsx | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/types/GranblueCookie.d.ts b/types/GranblueCookie.d.ts index eb0cca52..fb7e89ff 100644 --- a/types/GranblueCookie.d.ts +++ b/types/GranblueCookie.d.ts @@ -1,5 +1,5 @@ interface GranblueCookie { - account: AccountCookie - user: UserCookie + account?: AccountCookie + user?: UserCookie locale: string } diff --git a/utils/retrieveCookies.tsx b/utils/retrieveCookies.tsx index 3577625a..68337b89 100644 --- a/utils/retrieveCookies.tsx +++ b/utils/retrieveCookies.tsx @@ -6,18 +6,20 @@ export default function retrieveCookies( res?: NextApiResponse ): GranblueCookie | undefined { const cookies = getCookies({ req, res }) - if (!cookies) return undefined - const { account: accountData, user: userData, NEXT_LOCALE: localeData, } = cookies - if (!accountData || !userData) return undefined - const account = JSON.parse(decodeURIComponent(accountData)) ?? undefined - const user = JSON.parse(decodeURIComponent(userData)) ?? undefined - const locale = localeData as string + if ((!accountData || !userData) && localeData) + return { account: undefined, user: undefined, locale: localeData } - return { account, user, locale } + if (accountData && userData) { + const account = JSON.parse(decodeURIComponent(accountData)) ?? undefined + const user = JSON.parse(decodeURIComponent(userData)) ?? undefined + const locale = localeData as string + + return { account, user, locale } + } } From dc99c9b525687037921ac626affaa4eba2c303e9 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 3 Jan 2023 23:10:08 -0800 Subject: [PATCH 2/2] Fix positioning of thumb in switch We were using translateX to move the switch and animate it with transform, but the page refreshes immediately after you tap it so it doesn't matter. --- components/HeaderMenu/index.scss | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/HeaderMenu/index.scss b/components/HeaderMenu/index.scss index bbea705d..e5584f7f 100644 --- a/components/HeaderMenu/index.scss +++ b/components/HeaderMenu/index.scss @@ -88,8 +88,9 @@ display: block; height: $diameter; width: $diameter; - transition: transform 100ms; - transform: translateX(-2px); + position: absolute; + top: 3px; + left: 3px; z-index: 3; &:hover { @@ -98,7 +99,7 @@ &[data-state='checked'] { background: $grey-100; - transform: translateX(17px); + left: 23px; } }