This repository has been archived by the owner on Jul 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: complete dashboard page and sockets enabled
- Loading branch information
1 parent
e510f16
commit 373ec1f
Showing
55 changed files
with
1,515 additions
and
217 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 +1 @@ | ||
REACT_APP_BASE_URL='http://testnet.solana.com' | ||
REACT_APP_BASE_URL='edge.testnet.solana.com' |
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,6 @@ | ||
import RobustWebSocket from 'robust-websocket'; | ||
import {BLOCK_EXPLORER_WS_API_BASE} from 'v2/const'; | ||
|
||
export const initSocket = () => { | ||
return new RobustWebSocket(BLOCK_EXPLORER_WS_API_BASE); | ||
}; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
98 changes: 98 additions & 0 deletions
98
src/v2/components/Dashboard/NetworkOverview/NodesMap/index.jsx
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,98 @@ | ||
import {Typography} from '@material-ui/core'; | ||
import {observer} from 'mobx-react-lite'; | ||
import React from 'react'; | ||
import { | ||
ComposableMap, | ||
Geographies, | ||
Geography, | ||
Marker, | ||
Markers, | ||
ZoomableGroup, | ||
} from 'react-simple-maps'; | ||
import {map} from 'lodash/fp'; | ||
import NodesStore from 'v2/stores/nodes'; | ||
import MapTooltip from 'v2/components/UI/MapTooltip'; | ||
import {mapStyle, markerStyle} from 'v2/theme'; | ||
|
||
import useStyles from './styles'; | ||
|
||
const mapStyles = { | ||
default: mapStyle, | ||
hover: mapStyle, | ||
pressed: mapStyle, | ||
}; | ||
|
||
const NodesMap = () => { | ||
const classes = useStyles(); | ||
const {mapMarkers} = NodesStore; | ||
|
||
const mapConfig = { | ||
projection: { | ||
scale: 85, | ||
rotation: [-11, 0, 0], | ||
}, | ||
style: { | ||
width: '100%', | ||
height: 'auto', | ||
}, | ||
center: [0, 20], | ||
}; | ||
|
||
const renderMarker = marker => ( | ||
<Marker key={marker.name} style={markerStyle} marker={marker}> | ||
<MapTooltip | ||
classes={{tooltip: classes.tooltip}} | ||
title={() => ( | ||
<> | ||
<div className={classes.tooltipTitle}>NODE: {marker.name}</div> | ||
<div className={classes.tooltipDesc}>Gossip: {marker.gossip}</div> | ||
</> | ||
)} | ||
> | ||
<circle | ||
cx={0} | ||
cy={0} | ||
r={5} | ||
style={{ | ||
stroke: '#00FFAD', | ||
}} | ||
/> | ||
</MapTooltip> | ||
</Marker> | ||
); | ||
return ( | ||
<div className={classes.card}> | ||
<Typography>Nodes Map</Typography> | ||
<ComposableMap | ||
projectionConfig={mapConfig.projection} | ||
width={390} | ||
height={240} | ||
style={mapConfig.style} | ||
> | ||
<ZoomableGroup center={mapConfig.center} disablePanning> | ||
<Geographies | ||
geography={`${process.env.PUBLIC_URL}/resources/world-50m-simplified.json`} | ||
> | ||
{(geographies, projection) => | ||
geographies.map( | ||
(geography, i) => | ||
geography.id !== 'ATA' && ( | ||
<Geography | ||
key={i} | ||
tabable={false} | ||
geography={geography} | ||
projection={projection} | ||
style={mapStyles} | ||
/> | ||
), | ||
) | ||
} | ||
</Geographies> | ||
<Markers>{map(renderMarker)(mapMarkers)}</Markers> | ||
</ZoomableGroup> | ||
</ComposableMap> | ||
</div> | ||
); | ||
}; | ||
|
||
export default observer(NodesMap); |
28 changes: 28 additions & 0 deletions
28
src/v2/components/Dashboard/NetworkOverview/NodesMap/styles.js
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,28 @@ | ||
import {makeStyles} from '@material-ui/core'; | ||
import getColor from 'v2/utils/getColor'; | ||
|
||
export default makeStyles(theme => ({ | ||
card: { | ||
background: getColor('grey2')(theme), | ||
maxHeight: 290, | ||
overflow: 'hidden', | ||
padding: '14px 35px', | ||
}, | ||
tooltip: { | ||
background: '#fff', | ||
color: getColor('dark')(theme), | ||
padding: 10, | ||
borderRadius: 0, | ||
}, | ||
tooltipTitle: { | ||
fontSize: 15, | ||
marginBottom: 4, | ||
textOverflow: 'ellipsis', | ||
whiteSpace: 'nowrap', | ||
overflow: 'hidden', | ||
}, | ||
tooltipDesc: { | ||
fontSize: 12, | ||
color: getColor('grey3')(theme), | ||
}, | ||
})); |
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
3 changes: 1 addition & 2 deletions
3
src/v2/components/Dashboard/NetworkOverview/StatCards/styles.js
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.