-
Notifications
You must be signed in to change notification settings - Fork 54
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 #723 from invariant-labs/rpc-warning
add rpc warning
- Loading branch information
Showing
25 changed files
with
450 additions
and
94 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
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,52 @@ | ||
import { Box, Button, Typography } from '@material-ui/core' | ||
import useStyles from './style' | ||
import icons from '@static/icons' | ||
import { useState } from 'react' | ||
|
||
interface Props { | ||
rpcAddress: string | ||
useDefaultRpc: () => void | ||
useCurrentRpc: () => void | ||
} | ||
|
||
export const RpcErrorModal: React.FC<Props> = ({ rpcAddress, useDefaultRpc, useCurrentRpc }) => { | ||
const [rpc] = useState(rpcAddress) | ||
|
||
const classes = useStyles() | ||
|
||
return ( | ||
<> | ||
<div className={classes.background}></div> | ||
<div className={classes.container}> | ||
<img className={classes.warningIcon} src={icons.warningIcon} alt='Warning icon' /> | ||
<Typography className={classes.title}>RPC Connection Error</Typography> | ||
<Box | ||
display='flex' | ||
flexDirection='column' | ||
alignItems='center' | ||
/* @ts-expect-error */ | ||
sx={{ gap: 8, marginTop: 16 }}> | ||
<Typography className={classes.rpcText}> | ||
Your RPC might not be working due to one of the following reasons: | ||
<ul> | ||
<li>The RPC server is down or not responding.</li> | ||
<li>Your RPC subscription expired, causing the server to stop working.</li> | ||
<li>Your RPC plan may not support certain calls.</li> | ||
</ul> | ||
</Typography> | ||
<Typography className={classes.currentRpcText}> | ||
Current RPC: <span className={classes.currentRpc}>{rpc}</span> | ||
</Typography> | ||
</Box> | ||
<Box className={classes.buttonsContainer}> | ||
<Button className={classes.mainButton} onClick={useDefaultRpc}> | ||
Change to default RPC | ||
</Button> | ||
<Button className={classes.otherButton} onClick={useCurrentRpc}> | ||
Use current RPC anyway | ||
</Button> | ||
</Box> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import { makeStyles } from '@material-ui/core/styles' | ||
import { colors, typography } from '@static/theme' | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
background: { | ||
position: 'absolute', | ||
top: 0, | ||
bottom: 0, | ||
left: 0, | ||
right: 0, | ||
zIndex: 51, | ||
backdropFilter: 'blur(16px)' | ||
}, | ||
container: { | ||
position: 'absolute', | ||
top: 300, | ||
width: 480, | ||
left: '50%', | ||
transform: 'translate(-50%, -50%)', | ||
backgroundColor: colors.invariant.component, | ||
padding: 32, | ||
borderRadius: 20, | ||
color: colors.white.main, | ||
zIndex: 52, | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
|
||
[theme.breakpoints.down('xs')]: { | ||
width: 'calc(100% - 96px)', | ||
left: 16, | ||
right: 16, | ||
transform: 'none' | ||
} | ||
}, | ||
warningIcon: { | ||
height: 48 | ||
}, | ||
title: { | ||
...typography.heading3, | ||
marginTop: 16, | ||
textAlign: 'center' | ||
}, | ||
rpcText: { | ||
color: colors.invariant.lightGrey, | ||
fontWeight: 'normal' | ||
}, | ||
currentRpcText: { | ||
color: colors.invariant.lightGrey, | ||
fontWeight: 'normal', | ||
textAlign: 'center' | ||
}, | ||
currentRpc: { | ||
color: colors.white.main, | ||
fontWeight: 'bold' | ||
}, | ||
mainButton: { | ||
width: 240, | ||
height: 40, | ||
color: colors.invariant.black, | ||
...typography.body1, | ||
textTransform: 'none', | ||
background: colors.invariant.pinkLinearGradientOpacity, | ||
borderRadius: 14, | ||
|
||
'&:hover': { | ||
background: colors.invariant.pinkLinearGradient, | ||
boxShadow: `0 0 16px ${colors.invariant.pink}` | ||
} | ||
}, | ||
otherButton: { | ||
width: 240, | ||
height: 40, | ||
color: colors.white.main, | ||
...typography.body1, | ||
textTransform: 'none', | ||
background: colors.invariant.light, | ||
borderRadius: 14, | ||
|
||
'&:hover': { | ||
background: colors.invariant.light, | ||
boxShadow: `0 0 16px ${colors.invariant.light}` | ||
} | ||
}, | ||
buttonsContainer: { | ||
marginTop: 16, | ||
display: 'flex', | ||
alignItems: 'center', | ||
gap: 8, | ||
|
||
[theme.breakpoints.down('xs')]: { | ||
flexDirection: 'column' | ||
} | ||
} | ||
})) | ||
|
||
export default useStyles |
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.