-
Notifications
You must be signed in to change notification settings - Fork 51
Refactor(web)/delete web3 react files #949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
yep, the connector is not needed, and regarding the |
✅ Deploy Preview for kleros-v2 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for kleros-v2-contracts ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
web/src/components/ConnectButton.tsx
Outdated
<Button disabled={isOpen} small text={"Connect"} onClick={async () => await open({ route: "ConnectWallet" })} /> | ||
); | ||
const { open, isOpen } = useWeb3Modal(); | ||
if (isConnected && chain && chain.id !== DEFAULT_CHAIN) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Break this statement in two:
if (isConnected)
if (chain && chain.id !== DEFAULT_CHAIN)
switchButton
else
display
else
connect
web/src/components/ConnectButton.tsx
Outdated
return <AccountDisplay />; | ||
} else { | ||
return ( | ||
<Button disabled={isOpen} small text={"Connect"} onClick={async () => await open({ route: "ConnectWallet" })} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abstract this into a component
/> | ||
); | ||
}; | ||
|
||
const ConnectButton: React.FC = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename component and file to ConnectWallet
} | ||
}} | ||
/> | ||
{chain && chain.id === DEFAULT_CHAIN ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abstract this into ensureChain
function, that receives a ReactNode and wraps it with the check
Kudos, SonarCloud Quality Gate passed!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
maybe this is not done correctly:
and I don't know if we need the files
utils/switchChain.ts
andWrongChainBoundary.tsx
etc anymore