fix: add loading state to info page (#584)

* fix: add loading state to info page

* refactor: use bee-js for readiness check
This commit is contained in:
Cafe137
2022-11-14 14:22:49 +01:00
committed by GitHub
parent 1ce4a47495
commit 02469046b0
8 changed files with 160 additions and 95 deletions
+16 -4
View File
@@ -1,17 +1,29 @@
import { ReactElement, useContext } from 'react'
import Search from 'remixicon-react/SearchLineIcon'
import Globe from 'remixicon-react/GlobalLineIcon'
import Search from 'remixicon-react/SearchLineIcon'
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 Card from '../../components/Card'
import { CheckState, Context as BeeContext } from '../../providers/Bee'
import { ROUTES } from '../../routes'
export default function NodeInfoCard(): ReactElement {
const { status } = useContext(BeeContext)
const { debugApiHealth, debugApiReadiness, status } = useContext(BeeContext)
const navigate = useNavigate()
if (debugApiHealth && !debugApiReadiness) {
return (
<Card
buttonProps={{ iconType: Settings, children: 'Open node setup', onClick: () => navigate(ROUTES.STATUS) }}
icon={<Globe />}
title="Starting up..."
subtitle="Your Bee node is currently launching."
status="loading"
/>
)
}
if (status.all === CheckState.ERROR) {
return (
<Card