From c4c1573263868b6dc8a863124e4aee824dceadbb Mon Sep 17 00:00:00 2001 From: Vojtech Simetka Date: Mon, 13 Sep 2021 12:25:01 +0200 Subject: [PATCH] feat: troubleshooting component (#204) * feat: troubleshooting component and general layout improvements * style: background color, links and button * chore: disable ripples and rounded corners on buttons * fix: spacing on the troubleshooting card --- src/components/SideBar.tsx | 12 ++- src/components/TopologyStats.tsx | 36 +++---- src/components/TroubleshootConnectionCard.tsx | 87 +++++++++------ src/layout/Dashboard.tsx | 33 +++--- src/pages/peers/PeerTable.tsx | 56 +++++----- src/pages/settings/index.tsx | 102 +++++++++--------- src/theme.tsx | 62 ++++++++++- 7 files changed, 230 insertions(+), 158 deletions(-) diff --git a/src/components/SideBar.tsx b/src/components/SideBar.tsx index 5500bef..38a805d 100644 --- a/src/components/SideBar.tsx +++ b/src/components/SideBar.tsx @@ -44,6 +44,8 @@ const navBarItems = [ }, ] +const drawerWidth = 300 + const useStyles = makeStyles((theme: Theme) => createStyles({ root: { @@ -52,6 +54,14 @@ const useStyles = makeStyles((theme: Theme) => paddingTop: theme.spacing(8), paddingBottom: theme.spacing(8), }, + drawer: { + width: drawerWidth, + flexShrink: 0, + }, + drawerPaper: { + width: drawerWidth, + backgroundColor: '#212121', + }, logo: { marginLeft: theme.spacing(8), marginRight: theme.spacing(8), @@ -86,7 +96,7 @@ export default function SideBar(): ReactElement { const classes = useStyles() return ( - + diff --git a/src/components/TopologyStats.tsx b/src/components/TopologyStats.tsx index 609499f..08baccf 100644 --- a/src/components/TopologyStats.tsx +++ b/src/components/TopologyStats.tsx @@ -40,25 +40,23 @@ const Indicator = ({ thresholds }: Props): ReactElement => { } const Metrics = ({ topology, thresholds }: Props): ReactElement => ( - - - - - - - - - - - + + + + + + + + + ) diff --git a/src/components/TroubleshootConnectionCard.tsx b/src/components/TroubleshootConnectionCard.tsx index 8c2f621..6f30355 100644 --- a/src/components/TroubleshootConnectionCard.tsx +++ b/src/components/TroubleshootConnectionCard.tsx @@ -1,48 +1,65 @@ import type { ReactElement } from 'react' import { Link } from 'react-router-dom' -import { makeStyles } from '@material-ui/core/styles' -import { Card, CardContent, Typography } from '@material-ui/core/' +import { createStyles, makeStyles, Theme } from '@material-ui/core/styles' +import { Button, Grid, Typography, Link as MuiLink } from '@material-ui/core/' import { ROUTES } from '../routes' +import { Activity } from 'react-feather' -const useStyles = makeStyles({ - root: { - flexGrow: 1, - marginTop: '20px', - }, - title: { - textAlign: 'center', - fontSize: 26, - }, -}) +const useStyles = makeStyles((theme: Theme) => + createStyles({ + root: { + height: '100%', + }, + content: { + maxWidth: 500, + marginBottom: theme.spacing(4), + '&:last-child': { + marginBottom: 0, + }, + }, + icon: { + height: '1rem', + }, + }), +) export default function TroubleshootConnectionCard(): ReactElement { const classes = useStyles() return ( - - - - Looks like your node is not connected + + + + Uh oh, it looks like your node is not connected. -
- - Click to run status checks on your nodes connection or check out the{' '} - - Swarm Bee Docs - - -
- -
-

- Still not working? Drop us a message on the Ethereum Swarm{' '} - - Discord - -

-
-
-
+
+ + + Please check your node status to fix the problem. You can also check out the{' '} + + Swarm Bee Docs + {' '} + or ask for support on the{' '} + + Ethereum Swarm Discord + + . + + + + + + + +
) } diff --git a/src/layout/Dashboard.tsx b/src/layout/Dashboard.tsx index 92d3c85..89486ad 100644 --- a/src/layout/Dashboard.tsx +++ b/src/layout/Dashboard.tsx @@ -12,11 +12,8 @@ import { Context } from '../providers/Bee' const useStyles = makeStyles((theme: Theme) => createStyles({ content: { - marginLeft: 300, - flexGrow: 1, backgroundColor: theme.palette.background.default, - padding: theme.spacing(3), - paddingBottom: '65px', + minHeight: '100vh', }, }), ) @@ -31,20 +28,22 @@ const Dashboard = (props: Props): ReactElement => { const { isLoading } = useContext(Context) return ( -
+
- -
- - {isLoading ? ( - - - - ) : ( - props.children - )} -
-
+ + + <> + + {isLoading ? ( +
+ +
+ ) : ( + props.children + )} + +
+
) } diff --git a/src/pages/peers/PeerTable.tsx b/src/pages/peers/PeerTable.tsx index 2b51c66..28ad060 100644 --- a/src/pages/peers/PeerTable.tsx +++ b/src/pages/peers/PeerTable.tsx @@ -59,36 +59,34 @@ function PeerTable(props: Props): ReactElement { } return ( -
- - - - - Index - Peer Id - Actions + +
+ + + Index + Peer Id + Actions + + + + {props.peers?.map((peer: Peer, idx: number) => ( + + + {idx + 1} + + {peer.address} + + + + + - - - {props.peers?.map((peer: Peer, idx: number) => ( - - - {idx + 1} - - {peer.address} - - - - - - - ))} - -
-
-
+ ))} + + + ) } diff --git a/src/pages/settings/index.tsx b/src/pages/settings/index.tsx index 9fa9ad3..afa8cab 100644 --- a/src/pages/settings/index.tsx +++ b/src/pages/settings/index.tsx @@ -1,5 +1,5 @@ -import React, { ReactElement, useState, useContext } from 'react' -import { Paper, Container, TextField, Typography, Button } from '@material-ui/core' +import { ReactElement, useState, useContext } from 'react' +import { Paper, TextField, Typography, Button } from '@material-ui/core' import { Context as SettingsContext } from '../../providers/Settings' export default function Settings(): ReactElement { @@ -16,55 +16,53 @@ export default function Settings(): ReactElement { const touched = host !== apiUrl || debugHost !== apiDebugUrl return ( -
- - - Settings - - - { - setHost(e.target.value) - }} - variant="filled" - /> - - - { - setDebugHost(e.target.value) - }} - margin="normal" - InputLabelProps={{ - shrink: true, - }} - variant="filled" - /> - - {touched ? ( -
- -
- ) : null} -
-
+ <> + + Settings + + + { + setHost(e.target.value) + }} + variant="filled" + /> + + + { + setDebugHost(e.target.value) + }} + margin="normal" + InputLabelProps={{ + shrink: true, + }} + variant="filled" + /> + + {touched ? ( +
+ +
+ ) : null} + ) } diff --git a/src/theme.tsx b/src/theme.tsx index f8ee6a4..af7ed18 100644 --- a/src/theme.tsx +++ b/src/theme.tsx @@ -9,10 +9,55 @@ declare module '@material-ui/core/styles/createPalette' { // Overwriting default components styles const componentsOverrides = (theme: Theme) => ({ - MuiDrawer: { - paper: { - width: 300, - backgroundColor: '#212121', + MuiContainer: { + root: { padding: theme.spacing(8) }, + maxWidthXs: { padding: theme.spacing(8) }, + maxWidthSm: { padding: theme.spacing(8) }, + maxWidthMd: { padding: theme.spacing(8) }, + maxWidthLg: { padding: theme.spacing(8) }, + maxWidthXl: { padding: theme.spacing(8) }, + }, + MuiButton: { + textSizeLarge: { + padding: theme.spacing(2), + }, + containedSizeLarge: { + padding: theme.spacing(2), + boxShadow: 'none', + borderRadius: 0, + '&:hover': { + backgroundColor: theme.palette.primary.main, + color: 'white', + boxShadow: 'none', + // https://github.com/mui-org/material-ui/issues/22543 + '@media (hover: none)': { + backgroundColor: theme.palette.primary.main, + color: 'white', + boxShadow: 'none', + }, + }, + }, + contained: { + backgroundColor: 'white', + boxShadow: 'none', + '&:hover': { + backgroundColor: theme.palette.primary.main, + color: 'white', + // https://github.com/mui-org/material-ui/issues/22543 + '@media (hover: none)': { + backgroundColor: theme.palette.primary.main, + color: 'white', + boxShadow: 'none', + }, + }, + '&:focus': { + backgroundColor: theme.palette.primary.main, + color: 'white', + }, + '&:active': { + backgroundColor: theme.palette.primary.main, + color: 'white', + }, }, }, MuiTab: { @@ -59,13 +104,16 @@ const propsOverrides = { MuiTab: { disableRipple: true, }, + MuiButtonBase: { + disableRipple: true, + }, } export const theme = createMuiTheme({ palette: { type: 'light', background: { - default: '#fafafa', + default: '#efefef', }, primary: { light: orange.A200, @@ -78,6 +126,10 @@ export const theme = createMuiTheme({ }, typography: { fontFamily: ['Work Sans', 'Montserrat', 'Nunito', 'Roboto', '"Helvetica Neue"', 'Arial', 'sans-serif'].join(','), + h1: { + fontSize: '1.3rem', + fontWeight: 500, + }, }, })