-
Notifications
You must be signed in to change notification settings - Fork 10
Change network detection to Web3Context #98
base: staging
Are you sure you want to change the base?
Conversation
The wrong network alert is shown from Web3Context and a rightNetwork flag is set to be able to know (using the context) if the user has the right network selected. Use readContracts from context to be able to show dev profiles even if the user is not on the right network.
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.
Nice!
@@ -283,6 +284,61 @@ export function Web3Provider({ children, network = "localhost", DEBUG = false, N | |||
/> | |||
</div> | |||
); | |||
} else { | |||
networkDisplay = ( | |||
<div style={{ zIndex: 10, position: "absolute", right: 0, top: 80, padding: 16 }}> |
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.
Please use the Chakra alert dialog component instead: you can incorporate this here: https://github.com/moonshotcollective/drecruit/blob/staging/packages/react-app/pages/index.js#L48
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.
@QEDK I'm changing this to use the AlertDialog, but I think that it's not want we want. The AlertDialog is a modal, blocking the access to the site. We want just tell the user that the network selected is wrong but allow the user to see the site and the profiles. Please, let me know what you think.
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.
@damianmarti This is intentional, but if you think it should be closable, it is trivial to implement it using <AlertDialogCloseButton />
however, it should be a blocking option which means that the user has to interact with the modal to make it close (so no implementation to automatically close should be added).
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.
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.
@damianmarti Once the alert dialog is dismissed, the UI will be accessible again (using local provider). Essentially for someone who does not want to switch networks the flow is same except there's no annoying alert left over, if they attempt to connect to the wrong network again, the alert dialog triggers again, so it's consistent and there's no UI remnant, that's the intent here. To clarify, I have no issue with adding a close button to the alert dialog, so that's good with me :)
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.
Ok! Thanks!
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.
@QEDK I made this change and fixed the chainChanged callback (the network provider was not changed before). I tested it changing from the right network to a wrong one, back and forth, and it seem to be working fine now. The action "Request Contact Information" is shown or hidden when you go from the right network to a wrong one. Please review it and let me know if something is wrong.
c3eb57e
to
3a98910
Compare
@QEDK Merged with staging! |
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.
Looks good to me!
Good job on the alert dialog on network change.
The wrong network alert is shown from Web3Context and a rightNetwork flag is set to be able to know (using the context) if the user has the right network selected.
Use readContracts from context to be able to show dev profiles even if the user is not on the right network.