-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from ssvlabs/stage
Stage to Stage
- Loading branch information
Showing
18 changed files
with
345 additions
and
101 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
REACT_APP_DEBUG=true | ||
REACT_APP_API_BASE_URL=https://api.stage.ssv.network/api/v4/prater | ||
REACT_APP_API_BASE_URL=https://api.stage.ssv.network/api/v4/holesky | ||
REACT_APP_LINK_SSV_WEBAPP=https://app.stage.ssv.network/ | ||
REACT_APP_GOOGLE_TAG_SECRET= | ||
REACT_APP_GOOGLE_TAG_URL= |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,16 @@ | ||
import React, { ImgHTMLAttributes } from 'react'; | ||
import { useStores } from '~app/hooks/useStores'; | ||
import ApplicationStore from '~app/common/stores/Application.store'; | ||
import { EChain } from '~lib/utils/ChainService'; | ||
|
||
const NetworkIcon = (props: { network: EChain } & ImgHTMLAttributes<unknown>) => { | ||
const stores = useStores(); | ||
const applicationStore: ApplicationStore = stores.Application; | ||
const imgSrc = `/images/networks/${props.network}${applicationStore.isDarkMode ? '_light' : '_dark'}.svg`; | ||
|
||
return ( | ||
<img width="24" height="24" src={imgSrc} alt={props.network} {...props} /> | ||
); | ||
}; | ||
|
||
export default NetworkIcon; |
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 @@ | ||
export { default } from './NetworkIcon'; |
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,77 @@ | ||
import React, { ChangeEvent } from 'react'; | ||
import Box from '@material-ui/core/Box'; | ||
import MenuItem from '@material-ui/core/MenuItem'; | ||
import Select from '@material-ui/core/Select'; | ||
import chainService, { EChain } from '~lib/utils/ChainService'; | ||
import NetworkIcon from '~app/common/components/NetworkIcon'; | ||
import { useStyles } from './NeworkSelect.styles'; | ||
import { KeyboardArrowDown } from '@material-ui/icons'; | ||
|
||
const availableNetworks = [EChain.Ethereum, EChain.Holesky]; | ||
|
||
const networkToConfigMap = { | ||
[EChain.Ethereum]: { | ||
url: 'https://explorer.ssv.network', | ||
label: 'Ethereum Mainnet', | ||
}, | ||
[EChain.Holesky]: { | ||
url: 'https://holesky.explorer.ssv.network', | ||
label: 'Holesky Testnet', | ||
}, | ||
}; | ||
|
||
export default function NetworkSelect() { | ||
const currentNetwork: EChain = chainService().getNetwork() as EChain; | ||
|
||
const classes = useStyles(); | ||
|
||
const handleChange = ( | ||
event: ChangeEvent<{ name?: string; value: unknown }>, | ||
) => { | ||
const urlToGo = networkToConfigMap[event.target.value as EChain].url; | ||
if (urlToGo) { | ||
window.open(urlToGo, '_self'); | ||
} | ||
}; | ||
|
||
return ( | ||
<Box className={classes.Wrapper}> | ||
<Select | ||
variant="standard" | ||
autoWidth | ||
value={currentNetwork} | ||
onChange={handleChange} | ||
IconComponent={KeyboardArrowDown} | ||
className={classes.Root} | ||
classes={{ | ||
select: classes.Select, | ||
icon: classes.Icon, | ||
}} | ||
MenuProps={{ | ||
anchorOrigin: { | ||
vertical: 'bottom', | ||
horizontal: -16, | ||
}, | ||
transformOrigin: { | ||
vertical: 'top', | ||
horizontal: 'left', | ||
}, | ||
getContentAnchorEl: null, | ||
classes: { | ||
paper: classes.ItemListWrapper, | ||
list: classes.ItemList, | ||
}, | ||
}} | ||
> | ||
{availableNetworks.map((net) => ( | ||
<MenuItem value={net}> | ||
<div className={classes.ItemWrapper}> | ||
<NetworkIcon network={net} className={classes.ItemIcon} /> | ||
{networkToConfigMap[net].label} | ||
</div> | ||
</MenuItem> | ||
))} | ||
</Select> | ||
</Box> | ||
); | ||
} |
57 changes: 57 additions & 0 deletions
57
src/app/common/components/NetworkSelect/NeworkSelect.styles.ts
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,57 @@ | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
|
||
export const useStyles = makeStyles((theme) => ({ | ||
Wrapper: { | ||
borderRadius: 8, | ||
background: theme.colors.gray0, | ||
padding: '0 16px', | ||
}, | ||
Root: { | ||
minWidth: 205, | ||
'&:after, &:before': { | ||
display: 'none !important', | ||
}, | ||
}, | ||
Select: { | ||
backgroundColor: 'initial !important', | ||
}, | ||
Icon: { | ||
boxSizing: 'content-box', | ||
width: 24, | ||
height: 24, | ||
}, | ||
|
||
ItemListWrapper: { | ||
width: 240, | ||
boxShadow: 'none', | ||
border: `1px solid ${theme.colors.gray20}`, | ||
}, | ||
|
||
ItemList: { | ||
backgroundColor: `${theme.colors.white}`, | ||
padding: 0, | ||
'& li:hover': { | ||
backgroundColor: `${theme.colors.gray20} !important`, | ||
}, | ||
'& li': { | ||
backgroundColor: `${theme.colors.white} !important`, | ||
}, | ||
'& li:not(:last-child)': { | ||
borderBottom: `1px solid ${theme.colors.gray20}`, | ||
}, | ||
}, | ||
|
||
ItemWrapper: { | ||
display: 'flex', | ||
'align-items': 'center', | ||
padding: '6px 0', | ||
paddingRight: '6px', | ||
|
||
fontSize: 16, | ||
fontWeight: 600, | ||
}, | ||
ItemIcon: { | ||
boxSizing: 'content-box', | ||
paddingRight: '12px', | ||
}, | ||
})); |
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 @@ | ||
export { default } from './NetworkSelect'; |
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
Oops, something went wrong.