Add network info

This commit is contained in:
Mati Dastugue 2021-06-01 10:56:47 -03:00
parent 9a03fa6702
commit 02901c40e2
2 changed files with 20 additions and 13 deletions

View File

@ -19,7 +19,8 @@ import { headerHeight, md, screenSm, sm } from 'src/theme/variables'
import { useStateHandler } from 'src/logic/hooks/useStateHandler' import { useStateHandler } from 'src/logic/hooks/useStateHandler'
import SafeLogo from '../assets/gnosis-safe-multisig-logo.svg' import SafeLogo from '../assets/gnosis-safe-multisig-logo.svg'
import { NETWORKSNAMES } from 'src/utils/constants' import { NETWORK_NAMES } from 'src/utils/constants'
import { getNetworkInfo } from 'src/config'
const styles = () => ({ const styles = () => ({
root: { root: {
@ -69,16 +70,8 @@ const styles = () => ({
const Layout = ({ classes, providerDetails, providerInfo }) => { const Layout = ({ classes, providerDetails, providerInfo }) => {
const { clickAway, open, toggle } = useStateHandler() const { clickAway, open, toggle } = useStateHandler()
const { clickAway: clickAwayNetworks, open: openNetworks, toggle: toggleNetworks } = useStateHandler() const { clickAway: clickAwayNetworks, open: openNetworks, toggle: toggleNetworks } = useStateHandler()
const networkInfo = getNetworkInfo()
const networkList = NETWORKSNAMES.map((network) => { console.log(networkInfo)
return (
<>
<NetworkLabel networkName={network} />
<Divider />
</>
)
})
return ( return (
<Row className={classes.summary}> <Row className={classes.summary}>
<Col className={classes.logo} middle="xs" start="xs"> <Col className={classes.logo} middle="xs" start="xs">
@ -129,7 +122,12 @@ const Layout = ({ classes, providerDetails, providerInfo }) => {
<> <>
<ClickAwayListener mouseEvent="onClick" onClickAway={clickAwayNetworks} touchEvent={false}> <ClickAwayListener mouseEvent="onClick" onClickAway={clickAwayNetworks} touchEvent={false}>
<List className={classes.network} component="div"> <List className={classes.network} component="div">
{networkList} {NETWORK_NAMES.map((network) => (
<React.Fragment key={network.name}>
<NetworkLabel networkName={network.name} />
<Divider />
</React.Fragment>
))}
</List> </List>
</ClickAwayListener> </ClickAwayListener>
</> </>

View File

@ -34,4 +34,13 @@ export const SPENDING_LIMIT_MODULE_ADDRESS =
export const KNOWN_MODULES = { export const KNOWN_MODULES = {
[SPENDING_LIMIT_MODULE_ADDRESS]: 'Spending limit', [SPENDING_LIMIT_MODULE_ADDRESS]: 'Spending limit',
} }
export const NETWORKSNAMES = ['Ethereum', 'xDai', 'Polygon', 'BSC', 'Arbitrium', 'EWC', 'Rinkeby', 'Volta'] export const NETWORK_NAMES = [
{ name: 'Ethereum', url: 'https://gnosis-safe.io/app' },
{ name: 'xDai', url: 'https://xdai.gnosis-safe.io/app' },
{ name: 'Polygon', url: 'https://polygon.gnosis-safe.io/app' },
{ name: 'BSC', url: 'https://bsc.gnosis-safe.io/app' },
{ name: 'Arbitrium', url: 'https://arbitrum.gnosis-safe.io/app' },
{ name: 'EWC', url: 'https://ewc.gnosis-safe.io/app' },
{ name: 'Rinkeby', url: 'https://rinkeby.gnosis-safe.io/app' },
{ name: 'Volta', url: 'https://volta.gnosis-safe.io/app' },
]