File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -71,16 +71,17 @@ export const SwitchChainButton: React.FC = () => {
7171
7272const ConnectButton : React . FC = ( ) => {
7373 const { chain } = useNetwork ( ) ;
74+ const { isConnected } = useAccount ( ) ;
7475 const { open, isOpen } = useWeb3Modal ( ) ;
75- return chain ? (
76- chain ?. id !== DEFAULT_CHAIN ? (
77- < SwitchChainButton />
78- ) : (
79- < AccountDisplay />
80- )
81- ) : (
82- < Button disabled = { isOpen } small text = { "Connect" } onClick = { async ( ) => await open ( { route : "ConnectWallet" } ) } />
83- ) ;
76+ if ( isConnected && chain && chain . id !== DEFAULT_CHAIN ) {
77+ return < SwitchChainButton /> ;
78+ } else if ( isConnected ) {
79+ return < AccountDisplay /> ;
80+ } else {
81+ return (
82+ < Button disabled = { isOpen } small text = { "Connect" } onClick = { async ( ) => await open ( { route : "ConnectWallet" } ) } />
83+ ) ;
84+ }
8485} ;
8586
8687export default ConnectButton ;
You can’t perform that action at this time.
0 commit comments