diff --git a/frontend/src/app/(routes)/(overview)/overview-components/Profile.tsx b/frontend/src/app/(routes)/(overview)/overview-components/Profile.tsx index 730972356..94aac2e9b 100644 --- a/frontend/src/app/(routes)/(overview)/overview-components/Profile.tsx +++ b/frontend/src/app/(routes)/(overview)/overview-components/Profile.tsx @@ -1,13 +1,10 @@ import { useAppDispatch, useAppSelector } from '@/custom-hooks/StateHooks'; import Image from 'next/image'; -import React, { useState } from 'react'; +import React from 'react'; import { Tooltip } from '@mui/material'; -import { LOGOUT_ICON, SUPPORTED_WALLETS } from '@/utils/constants'; -import { - establishWalletConnection, - resetWallet, -} from '@/store/features/wallet/walletSlice'; -import { getLocalNetworks, getWalletName, logout } from '@/utils/localStorage'; +import { LOGOUT_ICON } from '@/utils/constants'; +import { resetWallet } from '@/store/features/wallet/walletSlice'; +import { logout } from '@/utils/localStorage'; import { resetError, resetTxAndHash, @@ -17,54 +14,22 @@ import { resetState as rewardsReset } from '@/store/features/distribution/distri import { resetCompleteState as stakingReset } from '@/store/features/staking/stakeSlice'; import { resetState as authzReset } from '@/store/features/authz/authzSlice'; import useAuthzGrants from '@/custom-hooks/useAuthzGrants'; -import WalletPopup from '@/components/WalletPopup'; -import { networks } from '@/utils/chainsInfo'; const Profile = () => { const profileName = useAppSelector((state) => state.wallet.name); const dispatch = useAppDispatch(); const { disableAuthzMode } = useAuthzGrants(); - const [connectWalletDialogOpen, setConnectWalletDialogOpen] = - useState(false); - const handleClose = () => { - setConnectWalletDialogOpen( - (connectWalletDialogOpen) => !connectWalletDialogOpen - ); - }; - - const selectWallet = (walletName: string) => { - tryConnectWallet(walletName); - handleClose(); - }; - - const tryConnectWallet = (walletName: string) => { - dispatch( - establishWalletConnection({ - walletName, - networks: [...networks, ...getLocalNetworks()], - }) - ); - }; - - const selectedWallet = getWalletName(); - const walletLogo = SUPPORTED_WALLETS.filter((wallet) => { - return wallet.name.toLowerCase() === selectedWallet; - }); - return (
- - profile setConnectWalletDialogOpen(true)} - > - + profile

{profileName} @@ -91,12 +56,6 @@ const Profile = () => { alt="Logout" /> -

); }; diff --git a/frontend/src/components/LandingPage.tsx b/frontend/src/components/LandingPage.tsx index 581033d67..194f89750 100644 --- a/frontend/src/components/LandingPage.tsx +++ b/frontend/src/components/LandingPage.tsx @@ -133,7 +133,6 @@ export const Landingpage = ({ children }: { children: React.ReactNode }) => { isOpen={connectWalletDialogOpen} onClose={handleClose} selectWallet={selectWallet} - isSwitchWallet={false} />
diff --git a/frontend/src/components/WalletPopup.tsx b/frontend/src/components/WalletPopup.tsx index e0cdde799..61d7ffef7 100644 --- a/frontend/src/components/WalletPopup.tsx +++ b/frontend/src/components/WalletPopup.tsx @@ -2,32 +2,25 @@ import { DialogContent, Dialog } from '@mui/material'; import Image from 'next/image'; import React, { useState } from 'react'; import { dialogBoxPaperPropStyles } from '@/utils/commonStyles'; -import { getWalletName, setWalletName } from '@/utils/localStorage'; +import { getWalletName } from '@/utils/localStorage'; import { SUPPORTED_WALLETS } from '@/utils/constants'; const WalletPopup = ({ isOpen, onClose, selectWallet, - isSwitchWallet, }: { isOpen: boolean; onClose: () => void; selectWallet: (walletName: string) => void; - isSwitchWallet: boolean; }) => { const [selectedWallet, setSelectedWallet] = useState( getWalletName() ); - const handleWalletClick = async (walletName: string) => { + const handleWalletClick = (walletName: string) => { setSelectedWallet(walletName); - if (isSwitchWallet) { - await Promise.all([setWalletName(walletName)]); - window.location.reload(); - } else { - selectWallet(walletName); - } + selectWallet(walletName); }; return ( @@ -54,7 +47,7 @@ const WalletPopup = ({
- {isSwitchWallet ? 'Switch Wallet' : 'Connect Wallet'} + Connect Wallet
{SUPPORTED_WALLETS.map((wallet) => (