diff --git a/src/components/LoadAccountMenu.tsx b/src/components/LoadAccountMenu.tsx index 5dfb8f4f..f85bf1da 100644 --- a/src/components/LoadAccountMenu.tsx +++ b/src/components/LoadAccountMenu.tsx @@ -19,6 +19,7 @@ const StyledBox = styled(Box)(({ theme }) => ({ })) export const LoadAccountMenu = (props: { type: string + setOpen?: React.Dispatch> selectedAlias?: string updateAlias?: any }) => { @@ -26,6 +27,9 @@ export const LoadAccountMenu = (props: { const dispatch = useAppDispatch() const setAccount = account => dispatch(updateAccount(account)) const { updateStore } = useWallet() + function closeSelect() { + props.setOpen(v => !v) + } const dispatchNotification = ({ message, type }) => dispatch(updateNotificationStatus({ message, severity: type })) useEffectOnce(() => { @@ -33,7 +37,7 @@ export const LoadAccountMenu = (props: { ...props, setAccount, dispatchNotification, - + closeSelect, updateStore, }) }) // eslint-disable-line react-hooks/exhaustive-deps diff --git a/src/components/Navbar/Account.tsx b/src/components/Navbar/Account.tsx index 9240fda7..2f4bdefe 100644 --- a/src/components/Navbar/Account.tsx +++ b/src/components/Navbar/Account.tsx @@ -1,24 +1,24 @@ -import { Chip, MenuItem, MenuList, Select, Typography, useTheme } from '@mui/material' -import React, { useEffect } from 'react' +import { mdiCog, mdiLogout } from '@mdi/js' +import { Box, Chip, MenuItem, MenuList, Select, Typography, useTheme } from '@mui/material' +import React, { useEffect, useState } from 'react' +import { getNameOfWallet, getPchainAddress } from '../../helpers/walletStore' +import { useAppDispatch, useAppSelector } from '../../hooks/reduxHooks' import { changeActiveApp, getAccount, updateAccount, updatePchainAddress, } from '../../redux/slices/app-config' -import { getNameOfWallet, getPchainAddress } from '../../helpers/walletStore' -import { mdiCog, mdiLogout } from '@mdi/js' -import { useAppDispatch, useAppSelector } from '../../hooks/reduxHooks' -import AliasPicker from './AliasPicker' import Icon from '@mdi/react' -import { LoadAccountMenu } from '../LoadAccountMenu' import MHidden from '../@material-extend/MHidden' +import { LoadAccountMenu } from '../LoadAccountMenu' +import AliasPicker from './AliasPicker' import ThemeSwitcher from './ThemeSwitcher' // @ts-ignore +import { useNavigate } from 'react-router-dom' import store from 'wallet/store' import { updateAuthStatus } from '../../redux/slices/utils' -import { useNavigate } from 'react-router-dom' interface LoginIconProps { handleCloseSidebar: () => void @@ -51,7 +51,7 @@ export default function Account({ handleCloseSidebar }: LoginIconProps) { const handleKeyDown = e => { e.stopPropagation() } - + const [open, setOpen] = useState(false) return ( <> @@ -108,16 +108,21 @@ export default function Account({ handleCloseSidebar }: LoginIconProps) { <> {auth && (