fix: if the node has error, disable pages that can never load (#502)
This commit is contained in:
@@ -10,14 +10,15 @@ import ExpandableListItemActions from '../../../components/ExpandableListItemAct
|
|||||||
import ExpandableListItemKey from '../../../components/ExpandableListItemKey'
|
import ExpandableListItemKey from '../../../components/ExpandableListItemKey'
|
||||||
import { Loading } from '../../../components/Loading'
|
import { Loading } from '../../../components/Loading'
|
||||||
import { SwarmButton } from '../../../components/SwarmButton'
|
import { SwarmButton } from '../../../components/SwarmButton'
|
||||||
|
import TroubleshootConnectionCard from '../../../components/TroubleshootConnectionCard'
|
||||||
import config from '../../../config'
|
import config from '../../../config'
|
||||||
import { Context } from '../../../providers/Bee'
|
import { CheckState, Context } from '../../../providers/Bee'
|
||||||
import { ROUTES } from '../../../routes'
|
import { ROUTES } from '../../../routes'
|
||||||
import { AccountNavigation } from '../AccountNavigation'
|
import { AccountNavigation } from '../AccountNavigation'
|
||||||
import { Header } from '../Header'
|
import { Header } from '../Header'
|
||||||
|
|
||||||
export function AccountWallet(): ReactElement {
|
export function AccountWallet(): ReactElement {
|
||||||
const { balance, nodeAddresses, nodeInfo } = useContext(Context)
|
const { balance, nodeAddresses, nodeInfo, status } = useContext(Context)
|
||||||
|
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
||||||
@@ -33,6 +34,8 @@ export function AccountWallet(): ReactElement {
|
|||||||
navigate(ROUTES.TOP_UP)
|
navigate(ROUTES.TOP_UP)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (status.all === CheckState.ERROR) return <TroubleshootConnectionCard />
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Header />
|
<Header />
|
||||||
|
|||||||
@@ -10,13 +10,14 @@ import ExpandableListItemActions from '../../components/ExpandableListItemAction
|
|||||||
import { HistoryHeader } from '../../components/HistoryHeader'
|
import { HistoryHeader } from '../../components/HistoryHeader'
|
||||||
import { SwarmButton } from '../../components/SwarmButton'
|
import { SwarmButton } from '../../components/SwarmButton'
|
||||||
import { ROUTES } from '../../routes'
|
import { ROUTES } from '../../routes'
|
||||||
import { Context as BeeContext } from '../../providers/Bee'
|
import { CheckState, Context as BeeContext } from '../../providers/Bee'
|
||||||
import { Context as SettingsContext } from '../../providers/Settings'
|
import { Context as SettingsContext } from '../../providers/Settings'
|
||||||
import config from '../../config'
|
import config from '../../config'
|
||||||
import { BeeModes } from '@ethersphere/bee-js'
|
import { BeeModes } from '@ethersphere/bee-js'
|
||||||
import { restartBeeNode, upgradeToLightNode } from '../../utils/desktop'
|
import { restartBeeNode, upgradeToLightNode } from '../../utils/desktop'
|
||||||
import { Loading } from '../../components/Loading'
|
import { Loading } from '../../components/Loading'
|
||||||
import { useSnackbar } from 'notistack'
|
import { useSnackbar } from 'notistack'
|
||||||
|
import TroubleshootConnectionCard from '../../components/TroubleshootConnectionCard'
|
||||||
|
|
||||||
const useStyles = makeStyles(() =>
|
const useStyles = makeStyles(() =>
|
||||||
createStyles({
|
createStyles({
|
||||||
@@ -39,7 +40,7 @@ export default function TopUp(): ReactElement {
|
|||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const styles = useStyles()
|
const styles = useStyles()
|
||||||
const isBeeDesktop = config.BEE_DESKTOP_ENABLED
|
const isBeeDesktop = config.BEE_DESKTOP_ENABLED
|
||||||
const { balance, nodeInfo } = useContext(BeeContext)
|
const { balance, nodeInfo, status } = useContext(BeeContext)
|
||||||
const { providerUrl } = useContext(SettingsContext)
|
const { providerUrl } = useContext(SettingsContext)
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const { enqueueSnackbar } = useSnackbar()
|
const { enqueueSnackbar } = useSnackbar()
|
||||||
@@ -64,6 +65,8 @@ export default function TopUp(): ReactElement {
|
|||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (status.all === CheckState.ERROR) return <TroubleshootConnectionCard />
|
||||||
|
|
||||||
if (!balance) {
|
if (!balance) {
|
||||||
return <Loading />
|
return <Loading />
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user