feat: add dev mode flag (#246)
* feat: add dev mode flag * docs: add REACT_APP_DEV_MODE fixme comment * feat: also ignore chequebook status in dev mode * fix: print undefined overlay as empty string (#248) * docs: add dev mode to readme * docs: revert autoformat Co-authored-by: Attila Gazso <agazso@gmail.com>
This commit is contained in:
+14
-13
@@ -1,19 +1,18 @@
|
||||
import type { ChequebookBalance, Balance, Settlements } from '../types'
|
||||
import { createContext, ReactChild, ReactElement, useEffect, useState, useContext } from 'react'
|
||||
import { Token } from '../models/Token'
|
||||
import semver from 'semver'
|
||||
import { engines } from '../../package.json'
|
||||
import { Context as SettingsContext } from './Settings'
|
||||
|
||||
import type {
|
||||
NodeAddresses,
|
||||
ChequebookAddressResponse,
|
||||
LastChequesResponse,
|
||||
Health,
|
||||
LastChequesResponse,
|
||||
NodeAddresses,
|
||||
Peer,
|
||||
Topology,
|
||||
} from '@ethersphere/bee-js'
|
||||
import { createContext, ReactChild, ReactElement, useContext, useEffect, useState } from 'react'
|
||||
import semver from 'semver'
|
||||
import { engines } from '../../package.json'
|
||||
import { useLatestBeeRelease } from '../hooks/apiHooks'
|
||||
import { Token } from '../models/Token'
|
||||
import type { Balance, ChequebookBalance, Settlements } from '../types'
|
||||
import { Context as SettingsContext } from './Settings'
|
||||
|
||||
interface Status {
|
||||
all: boolean
|
||||
@@ -113,11 +112,13 @@ function getStatus(
|
||||
blockchainConnection: Boolean(nodeAddresses?.ethereum),
|
||||
debugApiConnection: Boolean(debugApiHealth?.status === 'ok'),
|
||||
apiConnection: apiHealth,
|
||||
topology: Boolean(topology?.connected && topology?.connected > 0),
|
||||
// FIXME: `REACT_APP_DEV_MODE` is a temporary workaround to be able to develop with only one node
|
||||
topology: Boolean(topology?.connected && topology?.connected > 0) || Boolean(process.env.REACT_APP_DEV_MODE),
|
||||
chequebook:
|
||||
Boolean(chequebookAddress?.chequebookAddress) &&
|
||||
chequebookBalance !== null &&
|
||||
chequebookBalance?.totalBalance.toBigNumber.isGreaterThan(0),
|
||||
(Boolean(chequebookAddress?.chequebookAddress) &&
|
||||
chequebookBalance !== null &&
|
||||
chequebookBalance?.totalBalance.toBigNumber.isGreaterThan(0)) ||
|
||||
Boolean(process.env.REACT_APP_DEV_MODE),
|
||||
}
|
||||
|
||||
return { ...status, all: !error && Object.values(status).every(v => v) }
|
||||
|
||||
Reference in New Issue
Block a user