Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Change network detection to Web3Context #98

Open
wants to merge 7 commits into
base: staging
Choose a base branch
from

Conversation

damianmarti
Copy link
Contributor

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.

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.
Copy link
Contributor

@Cali93 Cali93 left a 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 }}>
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@QEDK I understand from my chats with @Cali93 that we want that the site can be viewed even if the user is not in the right network. If we want this, I think that we shouldn't use a modal alert dialog for this. I think we should use just a Chakra alert.

Copy link
Member

@QEDK QEDK Dec 1, 2021

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 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok! Thanks!

Copy link
Contributor Author

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.

@damianmarti damianmarti force-pushed the wrong-network-alert-on-web3-context branch from c3eb57e to 3a98910 Compare December 2, 2021 19:59
@damianmarti
Copy link
Contributor Author

@QEDK Merged with staging!

Copy link
Contributor

@Cali93 Cali93 left a 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants