fix: add troubleshooting checks (#435)

* fix: add troubleshooting checks

* feat: add node warning state
This commit is contained in:
Vojtech Simetka
2022-06-24 14:03:20 +02:00
committed by GitHub
parent 4cd580ca7f
commit a756eedc49
4 changed files with 57 additions and 22 deletions
+48
View File
@@ -0,0 +1,48 @@
import { ReactElement, useContext } from 'react'
import Search from 'remixicon-react/SearchLineIcon'
import Globe from 'remixicon-react/GlobalLineIcon'
import Settings from 'remixicon-react/Settings2LineIcon'
import { CheckState, Context as BeeContext } from '../../providers/Bee'
import Card from '../../components/Card'
import { useNavigate } from 'react-router'
import { ROUTES } from '../../routes'
export default function NodeInfoCard(): ReactElement {
const { status } = useContext(BeeContext)
const navigate = useNavigate()
if (status.all === CheckState.ERROR) {
return (
<Card
buttonProps={{ iconType: Settings, children: 'Open node setup', onClick: () => navigate(ROUTES.STATUS) }}
icon={<Globe />}
title="Your node is not connected…"
subtitle="You are not connected to Swarm."
status="error"
/>
)
}
if (status.all === CheckState.WARNING) {
return (
<Card
buttonProps={{ iconType: Settings, children: 'Open node setup', onClick: () => navigate(ROUTES.STATUS) }}
icon={<Globe />}
title="Your node is running…"
subtitle="Connection to Swarm might not be optimal."
status="error"
/>
)
}
return (
<Card
buttonProps={{ iconType: Search, children: 'Access Content', onClick: () => navigate(ROUTES.DOWNLOAD) }}
icon={<Globe />}
title="Your node is connected."
subtitle="You are connected to Swarm."
status="ok"
/>
)
}
+2 -20
View File
@@ -2,9 +2,6 @@ import { ReactElement, useContext } from 'react'
import { Button } from '@material-ui/core'
import Wallet from 'remixicon-react/Wallet3LineIcon'
import ExchangeFunds from 'remixicon-react/ExchangeFundsLineIcon'
import Search from 'remixicon-react/SearchLineIcon'
import Globe from 'remixicon-react/GlobalLineIcon'
import Settings from 'remixicon-react/Settings2LineIcon'
import Upload from 'remixicon-react/UploadLineIcon'
import { Context as BeeContext } from '../../providers/Bee'
@@ -15,6 +12,7 @@ import { useNavigate } from 'react-router'
import { ROUTES } from '../../routes'
import { useIsBeeDesktop, useNewBeeDesktopVersion } from '../../hooks/apiHooks'
import { BEE_DESKTOP_LATEST_RELEASE_PAGE } from '../../utils/desktop'
import NodeInfoCard from './NodeInfoCard'
export default function Status(): ReactElement {
const {
@@ -34,23 +32,7 @@ export default function Status(): ReactElement {
return (
<div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'stretch', alignContent: 'stretch' }}>
{status.all === 'OK' ? (
<Card
buttonProps={{ iconType: Search, children: 'Access Content', onClick: () => navigate(ROUTES.DOWNLOAD) }}
icon={<Globe />}
title="Your node is connected."
subtitle="You are connected to Swarm."
status="ok"
/>
) : (
<Card
buttonProps={{ iconType: Settings, children: 'Open node setup', onClick: () => navigate(ROUTES.STATUS) }}
icon={<Globe />}
title="Your node is not connected…"
subtitle="You are not connected to Swarm."
status="error"
/>
)}
<NodeInfoCard />
<div style={{ width: '8px' }}></div>
{nodeInfo?.beeMode && ['light', 'full', 'dev'].includes(nodeInfo.beeMode) ? (
<Card