-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update wallet-ui unsupported MM version management (#424)
* feat: update wallet-ui message * feat: detect mm version and show modal if needed * Update packages/wallet-ui/src/hooks/useHasMetamask.ts Co-authored-by: Stanley Yuen <[email protected]> * Update packages/wallet-ui/src/hooks/useHasMetamask.ts Co-authored-by: Stanley Yuen <[email protected]> * chore: fix comments * chore: fix comments * fix: separate message in MetaMask upgrade required or Snap update required * chore: fix sonarcloud * chore: lint * chore: text * chore: lint * Update packages/wallet-ui/src/components/ui/organism/MinVersionModal/MinVersionModal.view.tsx * Update packages/wallet-ui/src/components/ui/organism/MinVersionModal/MinVersionModal.view.tsx * chore: re-run checks * chore: re-run checks --------- Co-authored-by: Stanley Yuen <[email protected]>
- Loading branch information
1 parent
6a0236b
commit f6cde30
Showing
5 changed files
with
77 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 42 additions & 18 deletions
60
packages/wallet-ui/src/components/ui/organism/MinVersionModal/MinVersionModal.view.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,56 @@ | ||
import { MIN_METAMASK_VERSION } from 'utils/constants'; | ||
import { | ||
Description, | ||
MetaMaskLogo, | ||
StarknetLogo, | ||
Title, | ||
Wrapper, | ||
} from './MinVersionModal.style'; | ||
import { useHasMetamask } from 'hooks/useHasMetamask'; | ||
import { ConnectButton } from '../ConnectModal/ConnectModal.style'; | ||
|
||
export const MinVersionModalView = () => { | ||
const { metaMaskUpgradeRequired } = useHasMetamask(); | ||
return ( | ||
<Wrapper> | ||
<StarknetLogo /> | ||
<Title>A new version of the Starknet Snap is available</Title> | ||
<Description> | ||
To use this dapp, please install the latest version by following those | ||
steps: | ||
<ul> | ||
<li> | ||
Delete the current version in MetaMask by going in Settings {'>'}{' '} | ||
Snaps {'>'} @consensys/starknet-snap {'>'} See details {'>'} Remove | ||
Snap | ||
</li> | ||
<li>Refresh the page</li> | ||
<li> | ||
Click on connect, the new version will be proposed for installation. | ||
</li> | ||
</ul> | ||
Note: Your account will be automatically recovered. Future upgrades will | ||
be managed automatically | ||
</Description> | ||
{metaMaskUpgradeRequired ? ( | ||
<> | ||
<Title>An upgrade of MetaMask is needed to use this dApp</Title> | ||
<br /> | ||
<Description> | ||
Please update to MetaMask Version {MIN_METAMASK_VERSION} or higher. | ||
</Description> | ||
<br /> | ||
<a href="https://metamask.io" target="_blank" rel="noreferrer"> | ||
<ConnectButton customIconLeft={<MetaMaskLogo />} onClick={() => {}}> | ||
Go to MetaMask Website | ||
</ConnectButton> | ||
</a> | ||
</> | ||
) : ( | ||
<> | ||
<Title>A new version of the Starknet Snap is available</Title> | ||
<Description> | ||
To use this dapp, please install the latest version by following | ||
those steps: | ||
<ul> | ||
<li> | ||
Delete the current version in MetaMask by going in Settings{' '} | ||
{'>'} Snaps {'>'} @consensys/starknet-snap {'>'} See details{' '} | ||
{'>'} Remove Snap | ||
</li> | ||
<li>Refresh the page</li> | ||
<li> | ||
Click on connect, the new version will be proposed for | ||
installation. | ||
</li> | ||
</ul> | ||
Note: Your account will be automatically recovered. Future upgrades | ||
will be managed automatically | ||
</Description> | ||
</> | ||
)} | ||
</Wrapper> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters