From 4d1b3fbb71de4ff87b93c7de88c7350414365790 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sat, 28 Jan 2023 03:53:53 -0800 Subject: [PATCH 1/4] Remove HeaderMenu component --- components/HeaderMenu/index.scss | 0 components/HeaderMenu/index.tsx | 205 ------------------------------- 2 files changed, 205 deletions(-) delete mode 100644 components/HeaderMenu/index.scss delete mode 100644 components/HeaderMenu/index.tsx diff --git a/components/HeaderMenu/index.scss b/components/HeaderMenu/index.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/components/HeaderMenu/index.tsx b/components/HeaderMenu/index.tsx deleted file mode 100644 index d42795b2..00000000 --- a/components/HeaderMenu/index.tsx +++ /dev/null @@ -1,205 +0,0 @@ -import React, { useEffect, useState } from 'react' -import { useRouter } from 'next/router' -import { useTranslation } from 'next-i18next' -import { setCookie } from 'cookies-next' -import classNames from 'classnames' -import { retrieveCookies, retrieveLocaleCookies } from '~utils/retrieveCookies' - -import Link from 'next/link' -import * as Switch from '@radix-ui/react-switch' - -import AccountModal from '~components/AccountModal' -import LoginModal from '~components/LoginModal' -import SignupModal from '~components/SignupModal' - -import './index.scss' - -interface Props { - authenticated: boolean - open: boolean - username?: string - onClickOutside: () => void - logout?: () => void -} - -const HeaderMenu = (props: Props) => { - // Setup - const router = useRouter() - const data: GranblueCookie | undefined = retrieveCookies() - const localeData = retrieveLocaleCookies() - const { t } = useTranslation('common') - - // Refs - const ref: React.RefObject = React.createRef() - - useEffect(() => { - const handleClickOutside = (event: Event) => { - const target = event.target instanceof Element ? event.target : null - const isButton = target && target.closest('.Button.Active') - - if ( - ref.current && - target && - !ref.current.contains(target) && - !isButton && - props.open - ) { - props.onClickOutside() - } - } - document.addEventListener('click', handleClickOutside, true) - - return () => { - document.removeEventListener('click', handleClickOutside, true) - } - }, [props.onClickOutside]) - - const [checked, setChecked] = useState(false) - - useEffect(() => { - setChecked(localeData === 'ja' ? true : false) - }, [localeData]) - - function handleCheckedChange(value: boolean) { - const language = value ? 'ja' : 'en' - - const expiresAt = new Date() - expiresAt.setDate(expiresAt.getDate() + 60) - - setCookie('NEXT_LOCALE', language, { path: '/', expires: expiresAt }) - router.push(router.asPath, undefined, { locale: language }) - } - - const menuClasses = classNames({ - Menu: true, - auth: props.authenticated, - open: props.open, - }) - - function authItems() { - return ( - - ) - } - - function unauthItems() { - return ( - - ) - } - - return ( - - ) -} - -export default HeaderMenu From b580b3ddaf8dbbb6db142b0d019a40b2d5c7a7c0 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sat, 28 Jan 2023 03:56:22 -0800 Subject: [PATCH 2/4] Remove redundant values --- components/SelectItem/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/SelectItem/index.tsx b/components/SelectItem/index.tsx index 083bfdb5..60b3e4e3 100644 --- a/components/SelectItem/index.tsx +++ b/components/SelectItem/index.tsx @@ -11,7 +11,7 @@ interface Props extends ComponentProps<'div'> { } const SelectItem = React.forwardRef(function selectItem( - { children, value, iconSrc, altText, ...props }, + { children, value, ...props }, forwardedRef ) { const { altText, iconSrc, ...rest } = props From d8936c83201d3c7ec9d4c92c052e68dc94acf268 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sat, 28 Jan 2023 03:56:30 -0800 Subject: [PATCH 3/4] Add function name --- components/DropdownMenuContent/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/DropdownMenuContent/index.tsx b/components/DropdownMenuContent/index.tsx index 3e472872..37a47f5e 100644 --- a/components/DropdownMenuContent/index.tsx +++ b/components/DropdownMenuContent/index.tsx @@ -14,7 +14,10 @@ export const DropdownMenuGroup = DropdownMenuPrimitive.Group export const DropdownMenuSeparator = DropdownMenuPrimitive.Separator export const DropdownMenuContent = React.forwardRef( - ({ children, ...props }: PropsWithChildren, forwardedRef) => { + function dropdownMenuContent( + { children, ...props }: PropsWithChildren, + forwardedRef + ) { const classes = classNames(props.className, { Menu: true, }) From 3d4e73675fcc2faf77543c677e35181a791e0260 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sat, 28 Jan 2023 03:56:42 -0800 Subject: [PATCH 4/4] Fix assignment for new avatar object structure --- components/PartyDetails/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/PartyDetails/index.tsx b/components/PartyDetails/index.tsx index e2e4b2d0..f0b3d8a6 100644 --- a/components/PartyDetails/index.tsx +++ b/components/PartyDetails/index.tsx @@ -399,8 +399,8 @@ const PartyDetails = (props: Props) => { let username, picture, element if (accountState.account.authorized && props.new) { username = accountState.account.user?.username - picture = accountState.account.user?.picture - element = accountState.account.user?.element + picture = accountState.account.user?.avatar.picture + element = accountState.account.user?.avatar.element } else if (party.user && !props.new) { username = party.user.username picture = party.user.avatar.picture