-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'add-vaults-page' of https://github.com/CrocSwap/ambient…
…-ts-app into add-vaults-page
- Loading branch information
Showing
5 changed files
with
59 additions
and
2 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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.no_vaults { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100%; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import styles from './NoVaults.module.css'; | ||
import Button from '../../../components/Form/Button'; | ||
import { AppStateContext } from '../../../contexts'; | ||
import { useContext, useEffect } from 'react'; | ||
import { | ||
scrollMainnet, | ||
vaultSupportedNetworks, | ||
} from '../../../ambient-utils/constants'; | ||
import { useSwitchNetwork, useWeb3ModalAccount } from '@web3modal/ethers/react'; | ||
|
||
export default function NoVaults() { | ||
const { chooseNetwork } = useContext(AppStateContext); | ||
|
||
const { isConnected } = useWeb3ModalAccount(); | ||
const { switchNetwork } = useSwitchNetwork(); | ||
|
||
async function goToScroll(): Promise<void> { | ||
isConnected | ||
? await switchNetwork(parseInt(scrollMainnet.chainId)) | ||
: chooseNetwork(scrollMainnet); | ||
} | ||
|
||
useEffect(() => { | ||
console.log({ vaultSupportedNetworks }); | ||
}, [vaultSupportedNetworks]); | ||
|
||
const BUTTON_DOM_ID = 'change_network_to_scroll'; | ||
|
||
return ( | ||
<div className={styles.no_vaults}> | ||
<h3>To use Vaults please change network to Scroll.</h3> | ||
<Button | ||
idForDOM={BUTTON_DOM_ID} | ||
title='Change to Scroll' | ||
action={() => goToScroll()} | ||
/> | ||
</div> | ||
); | ||
} |
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