-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add troubleshooting checks (#435)
* fix: add troubleshooting checks * feat: add node warning state
- Loading branch information
1 parent
4cd580c
commit a756eed
Showing
4 changed files
with
57 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
/> | ||
) | ||
} |
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