Skip to content
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

➕ Add connect MetaMask modal #752

Merged

Conversation

GianfrancoBazzani
Copy link
Member

@GianfrancoBazzani GianfrancoBazzani self-assigned this Aug 28, 2024
@GianfrancoBazzani GianfrancoBazzani linked an issue Aug 28, 2024 that may be closed by this pull request
@ericglau
Copy link
Member

ericglau commented Aug 28, 2024

Would it make sense to add a way to close the modal, in case the user is not interested in connecting at the moment and just wants to look around?

@GianfrancoBazzani
Copy link
Member Author

GianfrancoBazzani commented Aug 28, 2024

Would it make sense to add a way to close the modal, in case the user is not interested in connecting at the moment and just wants to look around?

yes, absolutely! we have a similar behavior with networks being deprecated

client/src/gamedata/en/strings.json Show resolved Hide resolved
</a>
</div>
);
{this.props.web3 && !store.getState().gamedata.readOnly && (
Copy link
Member

@ericglau ericglau Aug 28, 2024

Choose a reason for hiding this comment

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

Once in read-only mode, it's not obvious how to exit read-only mode, especially if the network list is hidden. This could be addressed by doing one or more of the following if in read-only (but I don't think these are a must for this first iteration):

  • Adding a button here that brings back the MetaMask modal (or even just directly connects)
  • If the user clicks the "Play now!" button on the main page, this is an indication that the user actually wants to connect. In this case, exit read-only mode (or bring back the MetaMask modal, or directly connect)

Copy link
Member Author

Choose a reason for hiding this comment

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

I like both options! thanks for the suggestion!

Copy link
Member Author

@GianfrancoBazzani GianfrancoBazzani Aug 29, 2024

Choose a reason for hiding this comment

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

added a new button here that is displayed only if the game is in readonly mode and allows to connect the account without passing through the modal.

image

Added also modal trigger when user clicks "Play now!". Let me know if there's any issue.

Copy link
Member

Choose a reason for hiding this comment

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

This works great now, thanks a lot for addressing these so quickly!

@xaler5
Copy link
Collaborator

xaler5 commented Sep 2, 2024

The read-only mode was already existing whenever there was no web3 provider injected (different from having it but not being connected to).

In the former case, a warning is displayed to remember to the user that the game is on read-only mode. Can we keep the behaviour consistent with that ?

To see what I'm talking about you can for example joing the deploy preview from a mobile phone.

@GianfrancoBazzani GianfrancoBazzani merged commit 06dc0b4 into master Sep 3, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider avoiding auto-connect to Metamask
3 participants