From 373ec1fcdfcc575e1f60bb0d9f906dddce277956 Mon Sep 17 00:00:00 2001 From: Manuel Calavera Date: Wed, 3 Jul 2019 12:30:52 -0700 Subject: [PATCH] feat: complete dashboard page and sockets enabled --- .env.development | 2 +- .eslintrc.js | 3 +- config-overrides.js | 1 + package.json | 5 +- src/AppV2.js | 11 +- src/index.js | 4 +- src/v2/api/socket.js | 6 + src/v2/api/stats.js | 4 + src/v2/assets/icons/arrow-right.png | Bin 0 -> 376 bytes .../NetworkOverview/NodesMap/index.jsx | 98 +++++ .../NetworkOverview/NodesMap/styles.js | 28 ++ .../NetworkOverview/StatCards/index.jsx | 114 +++--- .../NetworkOverview/StatCards/styles.js | 3 +- .../Dashboard/NetworkOverview/TPS/index.jsx | 86 ++++ .../Dashboard/NetworkOverview/TPS/styles.js | 43 ++ .../Dashboard/NetworkOverview/index.jsx | 44 +- .../Dashboard/NetworkOverview/styles.js | 9 +- src/v2/components/Dashboard/ViewAll/index.jsx | 17 +- src/v2/components/Dashboard/index.jsx | 1 + src/v2/components/Footer/Newsletter/index.jsx | 31 ++ src/v2/components/Footer/Newsletter/styles.js | 40 ++ .../components/Footer/Partnership/index.jsx | 37 ++ .../components/Footer/Partnership/styles.js | 31 ++ src/v2/components/Footer/assets/bg.svg | 35 ++ src/v2/components/Footer/index.jsx | 35 ++ src/v2/components/Footer/styles.js | 29 ++ src/v2/components/Header/index.jsx | 2 +- src/v2/components/Header/styles.js | 3 +- src/v2/components/NavBar/index.jsx | 15 +- src/v2/components/Social/assets/discord.svg | 3 + src/v2/components/Social/assets/medium.svg | 3 + src/v2/components/Social/assets/reddit.svg | 4 + src/v2/components/Social/assets/telegram.svg | 3 + src/v2/components/Social/assets/twitter.svg | 3 + src/v2/components/Social/index.jsx | 56 +++ src/v2/components/Social/styles.js | 24 ++ src/v2/components/UI/Button/index.jsx | 5 +- src/v2/components/UI/Button/styles.js | 1 - .../UI/Logo/assets/logo_vertical.svg | 9 + src/v2/components/UI/Logo/index.jsx | 9 +- src/v2/components/UI/MapTooltip/index.jsx | 29 ++ src/v2/components/UI/MapTooltip/styles.js | 55 +++ .../UI/SectionHeader/assets}/decorate.png | Bin src/v2/components/UI/SectionHeader/index.jsx | 20 + src/v2/components/UI/SectionHeader/styles.js | 17 + src/v2/components/UI/StatCard/index.jsx | 46 +++ src/v2/components/UI/StatCard/styles.js | 24 ++ src/v2/const.js | 5 +- src/v2/stores/networkOverview.js | 137 +++++-- src/v2/stores/nodes.js | 51 +++ src/v2/stores/socket.js | 22 + src/v2/theme.js | 19 + src/v2/utils/calcChanges.js | 8 + src/v2/utils/parseMessage.js | 56 +++ yarn.lock | 386 ++++++++++++++---- 55 files changed, 1515 insertions(+), 217 deletions(-) create mode 100644 src/v2/api/socket.js create mode 100644 src/v2/assets/icons/arrow-right.png create mode 100644 src/v2/components/Dashboard/NetworkOverview/NodesMap/index.jsx create mode 100644 src/v2/components/Dashboard/NetworkOverview/NodesMap/styles.js create mode 100644 src/v2/components/Dashboard/NetworkOverview/TPS/index.jsx create mode 100644 src/v2/components/Dashboard/NetworkOverview/TPS/styles.js create mode 100644 src/v2/components/Footer/Newsletter/index.jsx create mode 100644 src/v2/components/Footer/Newsletter/styles.js create mode 100644 src/v2/components/Footer/Partnership/index.jsx create mode 100644 src/v2/components/Footer/Partnership/styles.js create mode 100644 src/v2/components/Footer/assets/bg.svg create mode 100644 src/v2/components/Footer/index.jsx create mode 100644 src/v2/components/Footer/styles.js create mode 100644 src/v2/components/Social/assets/discord.svg create mode 100644 src/v2/components/Social/assets/medium.svg create mode 100644 src/v2/components/Social/assets/reddit.svg create mode 100644 src/v2/components/Social/assets/telegram.svg create mode 100644 src/v2/components/Social/assets/twitter.svg create mode 100644 src/v2/components/Social/index.jsx create mode 100644 src/v2/components/Social/styles.js create mode 100644 src/v2/components/UI/Logo/assets/logo_vertical.svg create mode 100644 src/v2/components/UI/MapTooltip/index.jsx create mode 100644 src/v2/components/UI/MapTooltip/styles.js rename src/v2/{assets/img => components/UI/SectionHeader/assets}/decorate.png (100%) create mode 100644 src/v2/components/UI/SectionHeader/index.jsx create mode 100644 src/v2/components/UI/SectionHeader/styles.js create mode 100644 src/v2/components/UI/StatCard/index.jsx create mode 100644 src/v2/components/UI/StatCard/styles.js create mode 100644 src/v2/stores/nodes.js create mode 100644 src/v2/stores/socket.js create mode 100644 src/v2/utils/calcChanges.js create mode 100644 src/v2/utils/parseMessage.js diff --git a/.env.development b/.env.development index 7d9285bc..13223e44 100644 --- a/.env.development +++ b/.env.development @@ -1 +1 @@ -REACT_APP_BASE_URL='http://testnet.solana.com' +REACT_APP_BASE_URL='edge.testnet.solana.com' diff --git a/.eslintrc.js b/.eslintrc.js index 6ac3c066..4bbbf588 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -8,8 +8,9 @@ module.exports = { es6: true, node: true, }, - plugins: ['react'], + plugins: ['react', 'flowtype'], extends: [ + 'plugin:flowtype/recommended', 'eslint:recommended', 'plugin:react/recommended', 'plugin:import/errors', diff --git a/config-overrides.js b/config-overrides.js index 5b3719b9..0048c848 100644 --- a/config-overrides.js +++ b/config-overrides.js @@ -3,5 +3,6 @@ const {override, addBabelPlugin} = require('customize-cra'); module.exports = override( // addBabelPlugin('lodash'), + addBabelPlugin('date-fns'), addBabelPlugin('react-hot-loader/babel'), ); diff --git a/package.json b/package.json index fb75398e..08e20779 100644 --- a/package.json +++ b/package.json @@ -12,12 +12,14 @@ "url": "http://github.com/solana-labs/blockexplorer/issues" }, "dependencies": { + "@nivo/line": "^0.59.1", "@solana/web3.js": "^0.16.10", "babel-plugin-transform-runtime": "^6.23.0", "base-58": "^0.0.1", "classnames": "^2.2.6", "copy-to-clipboard": "^3.2.0", "cors": "^2.8.5", + "date-fns": "^1.30.1", "express": "^4.17.1", "express-ws": "^4.0.0", "geoip-lite": "^1.3.7", @@ -36,8 +38,6 @@ "yaml": "^1.6.0" }, "devDependencies": { - "@babel/plugin-proposal-class-properties": "^7.5.0", - "@babel/plugin-proposal-decorators": "^7.4.4", "@babel/register": "^7.4.4", "@commitlint/config-conventional": "^8.0.0", "@commitlint/travis-cli": "^8.0.0", @@ -46,6 +46,7 @@ "axios": "^0.19.0", "babel-cli": "^6.26.0", "babel-eslint": "^10.0.2", + "babel-plugin-date-fns": "^0.2.1", "babel-plugin-lodash": "^3.3.4", "babel-preset-env": "^1.7.0", "chart.js": "^2.8.0", diff --git a/src/AppV2.js b/src/AppV2.js index 290e5132..6c00bb63 100644 --- a/src/AppV2.js +++ b/src/AppV2.js @@ -5,19 +5,23 @@ import {hot} from 'react-hot-loader/root'; import {Route, Switch} from 'react-router-dom'; import Header from 'v2/components/Header'; import NavBar from 'v2/components/NavBar'; +import Footer from 'v2/components/Footer'; import theme from 'v2/theme'; +import socket from 'v2/stores/socket'; + +socket.init(); const Dashboard = lazy(() => import('v2/components/Dashboard')); const useStyles = makeStyles(theme => ({ root: { display: 'flex', + overflow: 'hidden', }, content: { flexGrow: 1, marginLeft: 50, - padding: theme.spacing(3), - paddingTop: 50, + padding: '50px 24px 0 24px', }, toolbar: { display: 'flex', @@ -40,9 +44,10 @@ const App = () => {
Loading...
}> - + +