feat: clarify labels and syncing (#670)
This commit is contained in:
Generated
+1117
-983
File diff suppressed because it is too large
Load Diff
+6
-6
@@ -37,7 +37,7 @@
|
|||||||
"crypto": "npm:crypto-browserify",
|
"crypto": "npm:crypto-browserify",
|
||||||
"crypto-browserify": "^3.12.0",
|
"crypto-browserify": "^3.12.0",
|
||||||
"dotted-map": "^2.2.3",
|
"dotted-map": "^2.2.3",
|
||||||
"ethers": "^5.6.4",
|
"ethers": "^5.7.2",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"formik": "2.2.9",
|
"formik": "2.2.9",
|
||||||
"formik-material-ui": "3.0.1",
|
"formik-material-ui": "3.0.1",
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
"opener": "1.5.2",
|
"opener": "1.5.2",
|
||||||
"qrcode.react": "1.0.1",
|
"qrcode.react": "1.0.1",
|
||||||
"react": ">= 17.0.2",
|
"react": ">= 17.0.2",
|
||||||
"react-copy-to-clipboard": "5.0.4",
|
"react-copy-to-clipboard": "^5.1.0",
|
||||||
"react-dom": ">= 17.0.2",
|
"react-dom": ">= 17.0.2",
|
||||||
"react-identicons": "1.2.5",
|
"react-identicons": "1.2.5",
|
||||||
"react-router": "6.2.1",
|
"react-router": "6.2.1",
|
||||||
@@ -76,15 +76,15 @@
|
|||||||
"@types/jest": "27.0.2",
|
"@types/jest": "27.0.2",
|
||||||
"@types/qrcode.react": "1.0.2",
|
"@types/qrcode.react": "1.0.2",
|
||||||
"@types/react": "17.0.34",
|
"@types/react": "17.0.34",
|
||||||
"@types/react-copy-to-clipboard": "5.0.2",
|
"@types/react-copy-to-clipboard": "^5.0.2",
|
||||||
"@types/react-dom": "17.0.11",
|
"@types/react-dom": "17.0.11",
|
||||||
"@types/react-router": "5.1.18",
|
"@types/react-router": "5.1.18",
|
||||||
"@types/react-router-dom": "5.3.2",
|
"@types/react-router-dom": "5.3.2",
|
||||||
"@types/react-syntax-highlighter": "13.5.2",
|
"@types/react-syntax-highlighter": "13.5.2",
|
||||||
"@typescript-eslint/eslint-plugin": "5.28.0",
|
"@typescript-eslint/eslint-plugin": "5.28.0",
|
||||||
"@typescript-eslint/parser": "5.28.0",
|
"@typescript-eslint/parser": "5.28.0",
|
||||||
"babel-eslint": "10.1.0",
|
"babel-eslint": "^10.1.0",
|
||||||
"babel-loader": "8.1.0",
|
"babel-loader": "^8.1.0",
|
||||||
"babel-plugin-syntax-dynamic-import": "6.18.0",
|
"babel-plugin-syntax-dynamic-import": "6.18.0",
|
||||||
"babel-plugin-tsconfig-paths": "1.0.2",
|
"babel-plugin-tsconfig-paths": "1.0.2",
|
||||||
"base64-inline-loader": "^2.0.1",
|
"base64-inline-loader": "^2.0.1",
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
"ts-node": "^10.8.1",
|
"ts-node": "^10.8.1",
|
||||||
"typescript": "4.8.3",
|
"typescript": "4.8.3",
|
||||||
"web-vitals": "2.1.2",
|
"web-vitals": "2.1.2",
|
||||||
"webpack": "^5.73.0",
|
"webpack": "^5.93.0",
|
||||||
"webpack-cli": "^4.10.0"
|
"webpack-cli": "^4.10.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ import { Box, Grid, IconButton, InputBase, ListItem, Typography } from '@materia
|
|||||||
import Collapse from '@material-ui/core/Collapse'
|
import Collapse from '@material-ui/core/Collapse'
|
||||||
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
|
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
|
||||||
import { ChangeEvent, ReactElement, useState } from 'react'
|
import { ChangeEvent, ReactElement, useState } from 'react'
|
||||||
|
import type { RemixiconReactIconProps } from 'remixicon-react'
|
||||||
import Check from 'remixicon-react/CheckLineIcon'
|
import Check from 'remixicon-react/CheckLineIcon'
|
||||||
|
import X from 'remixicon-react/CloseLineIcon'
|
||||||
import Edit from 'remixicon-react/PencilLineIcon'
|
import Edit from 'remixicon-react/PencilLineIcon'
|
||||||
import Minus from 'remixicon-react/SubtractLineIcon'
|
import Minus from 'remixicon-react/SubtractLineIcon'
|
||||||
import X from 'remixicon-react/CloseLineIcon'
|
|
||||||
import ExpandableListItemActions from './ExpandableListItemActions'
|
import ExpandableListItemActions from './ExpandableListItemActions'
|
||||||
import ExpandableListItemNote from './ExpandableListItemNote'
|
import ExpandableListItemNote from './ExpandableListItemNote'
|
||||||
import { SwarmButton } from './SwarmButton'
|
import { SwarmButton } from './SwarmButton'
|
||||||
import type { RemixiconReactIconProps } from 'remixicon-react'
|
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles((theme: Theme) =>
|
||||||
createStyles({
|
createStyles({
|
||||||
@@ -108,12 +108,8 @@ export default function ExpandableListItemKey({
|
|||||||
<div>
|
<div>
|
||||||
{!open && value}
|
{!open && value}
|
||||||
{!expandedOnly && !locked && (
|
{!expandedOnly && !locked && (
|
||||||
<IconButton size="small" className={classes.copyValue}>
|
<IconButton size="small" className={classes.copyValue} onClick={toggleOpen}>
|
||||||
{open ? (
|
{open ? <Minus strokeWidth={1} /> : <Edit strokeWidth={1} />}
|
||||||
<Minus onClick={toggleOpen} strokeWidth={1} />
|
|
||||||
) : (
|
|
||||||
<Edit onClick={toggleOpen} strokeWidth={1} />
|
|
||||||
)}
|
|
||||||
</IconButton>
|
</IconButton>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -77,20 +77,18 @@ export default function ExpandableListItemKey({ label, value, expanded }: Props)
|
|||||||
<Grid container direction="row" justifyContent="space-between" alignItems="center">
|
<Grid container direction="row" justifyContent="space-between" alignItems="center">
|
||||||
{label && <Typography variant="body1">{label}</Typography>}
|
{label && <Typography variant="body1">{label}</Typography>}
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
<div>
|
{!open && (
|
||||||
{!open && (
|
<span className={classes.copyValue}>
|
||||||
<span className={classes.copyValue}>
|
<Tooltip title={copied ? 'Copied' : 'Copy'} placement="top" arrow onClose={tooltipCloseHandler}>
|
||||||
<Tooltip title={copied ? 'Copied' : 'Copy'} placement="top" arrow onClose={tooltipCloseHandler}>
|
<CopyToClipboard text={value}>
|
||||||
<CopyToClipboard text={value}>
|
<span onClick={tooltipClickHandler}>{value ? spanText : ''}</span>
|
||||||
<span onClick={tooltipClickHandler}>{value ? spanText : ''}</span>
|
</CopyToClipboard>
|
||||||
</CopyToClipboard>
|
</Tooltip>
|
||||||
</Tooltip>
|
</span>
|
||||||
</span>
|
)}
|
||||||
)}
|
<IconButton size="small" className={classes.copyValue} onClick={toggleOpen}>
|
||||||
<IconButton size="small" className={classes.copyValue}>
|
{open ? <Minus strokeWidth={1} /> : <Eye strokeWidth={1} />}
|
||||||
{open ? <Minus onClick={toggleOpen} strokeWidth={1} /> : <Eye onClick={toggleOpen} strokeWidth={1} />}
|
</IconButton>
|
||||||
</IconButton>
|
|
||||||
</div>
|
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Collapse in={open} timeout="auto" unmountOnExit>
|
<Collapse in={open} timeout="auto" unmountOnExit>
|
||||||
|
|||||||
@@ -82,22 +82,20 @@ export default function ExpandableListItemLink({
|
|||||||
<Grid container direction="row" justifyContent="space-between" alignItems="center">
|
<Grid container direction="row" justifyContent="space-between" alignItems="center">
|
||||||
{label && <Typography variant="body1">{label}</Typography>}
|
{label && <Typography variant="body1">{label}</Typography>}
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
<div>
|
{allowClipboard && (
|
||||||
{allowClipboard && (
|
<span className={classes.copyValue}>
|
||||||
<span className={classes.copyValue}>
|
<Tooltip title={copied ? 'Copied' : 'Copy'} placement="top" arrow onClose={tooltipCloseHandler}>
|
||||||
<Tooltip title={copied ? 'Copied' : 'Copy'} placement="top" arrow onClose={tooltipCloseHandler}>
|
<CopyToClipboard text={value}>
|
||||||
<CopyToClipboard text={value}>
|
<span onClick={tooltipClickHandler}>{displayValue}</span>
|
||||||
<span onClick={tooltipClickHandler}>{displayValue}</span>
|
</CopyToClipboard>
|
||||||
</CopyToClipboard>
|
</Tooltip>
|
||||||
</Tooltip>
|
</span>
|
||||||
</span>
|
)}
|
||||||
)}
|
{!allowClipboard && <span onClick={onNavigation}>{displayValue}</span>}
|
||||||
{!allowClipboard && <span onClick={onNavigation}>{displayValue}</span>}
|
<IconButton size="small" className={classes.openLinkIcon} onClick={onNavigation}>
|
||||||
<IconButton size="small" className={classes.openLinkIcon}>
|
{navigationType === 'NEW_WINDOW' && <OpenInNewSharp strokeWidth={1} />}
|
||||||
{navigationType === 'NEW_WINDOW' && <OpenInNewSharp onClick={onNavigation} strokeWidth={1} />}
|
{navigationType === 'HISTORY_PUSH' && <ArrowForward strokeWidth={1} />}
|
||||||
{navigationType === 'HISTORY_PUSH' && <ArrowForward onClick={onNavigation} strokeWidth={1} />}
|
</IconButton>
|
||||||
</IconButton>
|
|
||||||
</div>
|
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { CircularProgress, Container, createStyles, makeStyles } from '@material
|
|||||||
import { ReactElement, useContext, useEffect } from 'react'
|
import { ReactElement, useContext, useEffect } from 'react'
|
||||||
import { useNavigate } from 'react-router'
|
import { useNavigate } from 'react-router'
|
||||||
import PlusSquare from 'remixicon-react/AddBoxLineIcon'
|
import PlusSquare from 'remixicon-react/AddBoxLineIcon'
|
||||||
|
import { ChainSync } from '../../../components/ChainSync'
|
||||||
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 TroubleshootConnectionCard from '../../../components/TroubleshootConnectionCard'
|
||||||
@@ -57,7 +58,7 @@ export function AccountStamps(): ReactElement {
|
|||||||
{error && (
|
{error && (
|
||||||
<Container style={{ textAlign: 'center', padding: '50px' }}>
|
<Container style={{ textAlign: 'center', padding: '50px' }}>
|
||||||
<Loading />
|
<Loading />
|
||||||
{error.message}
|
<ChainSync />
|
||||||
</Container>
|
</Container>
|
||||||
)}
|
)}
|
||||||
{!error && (
|
{!error && (
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ export function Download(): ReactElement {
|
|||||||
<>
|
<>
|
||||||
{nodeInfo?.beeMode !== BeeModes.ULTRA_LIGHT && <FileNavigation active="DOWNLOAD" />}
|
{nodeInfo?.beeMode !== BeeModes.ULTRA_LIGHT && <FileNavigation active="DOWNLOAD" />}
|
||||||
<ExpandableListItemInput
|
<ExpandableListItemInput
|
||||||
label="Swarm Hash"
|
label="Swarm Hash or ENS"
|
||||||
onConfirm={value => onSwarmIdentifier(value)}
|
onConfirm={value => onSwarmIdentifier(value)}
|
||||||
onChange={validateChange}
|
onChange={validateChange}
|
||||||
helperText={referenceError}
|
helperText={referenceError}
|
||||||
|
|||||||
@@ -1,35 +1,37 @@
|
|||||||
import { BeeModes } from '@ethersphere/bee-js'
|
import { BeeModes } from '@ethersphere/bee-js'
|
||||||
import { Box, Grid, Typography } from '@material-ui/core'
|
import { Box, Grid, Typography } from '@material-ui/core'
|
||||||
import { useSnackbar } from 'notistack'
|
import { useSnackbar } from 'notistack'
|
||||||
import { ReactElement, useContext, useEffect, useState } from 'react'
|
import { ReactElement, useContext, useEffect } from 'react'
|
||||||
import { useNavigate } from 'react-router'
|
import { useNavigate } from 'react-router'
|
||||||
|
import { ChainSync } from '../../components/ChainSync'
|
||||||
import { Waiting } from '../../components/Waiting'
|
import { Waiting } from '../../components/Waiting'
|
||||||
import { Context } from '../../providers/Bee'
|
import { Context } from '../../providers/Settings'
|
||||||
import { ROUTES } from '../../routes'
|
import { ROUTES } from '../../routes'
|
||||||
|
|
||||||
const STARTED_UPGRADE_AT = 'started-upgrade-at'
|
|
||||||
|
|
||||||
export default function LightModeRestart(): ReactElement {
|
export default function LightModeRestart(): ReactElement {
|
||||||
const [startedAt] = useState(Number.parseInt(localStorage.getItem(STARTED_UPGRADE_AT) ?? Date.now().toFixed()))
|
|
||||||
const { apiHealth, nodeInfo } = useContext(Context)
|
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const { enqueueSnackbar } = useSnackbar()
|
const { enqueueSnackbar } = useSnackbar()
|
||||||
|
const { beeApi } = useContext(Context)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
localStorage.setItem(STARTED_UPGRADE_AT, startedAt.toFixed())
|
if (!beeApi) {
|
||||||
}, [startedAt])
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (Date.now() - startedAt < 45_000) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (apiHealth && nodeInfo?.beeMode === BeeModes.LIGHT) {
|
const interval = setInterval(() => {
|
||||||
enqueueSnackbar('Upgraded to light node', { variant: 'success' })
|
beeApi
|
||||||
localStorage.removeItem(STARTED_UPGRADE_AT)
|
.getNodeInfo()
|
||||||
navigate(ROUTES.INFO)
|
.then(nodeInfo => {
|
||||||
}
|
if (nodeInfo.beeMode === BeeModes.LIGHT) {
|
||||||
}, [startedAt, navigate, nodeInfo, apiHealth, enqueueSnackbar])
|
enqueueSnackbar('Upgraded to light node', { variant: 'success' })
|
||||||
|
navigate(ROUTES.INFO)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(console.error) // eslint-disable-line
|
||||||
|
}, 3_000)
|
||||||
|
|
||||||
|
return () => clearInterval(interval)
|
||||||
|
}, [beeApi, enqueueSnackbar, navigate])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid container direction="column" justifyContent="center" alignItems="center">
|
<Grid container direction="column" justifyContent="center" alignItems="center">
|
||||||
@@ -41,9 +43,12 @@ export default function LightModeRestart(): ReactElement {
|
|||||||
<strong>Upgrading Bee</strong>
|
<strong>Upgrading Bee</strong>
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<Typography>
|
<Box mb={1}>
|
||||||
You will be redirected automatically once your node is up and running. This may take up to 10 minutes.
|
<Typography>
|
||||||
</Typography>
|
You will be redirected automatically once your node is up and running. This may take up to 10 minutes.
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
<ChainSync />
|
||||||
</Grid>
|
</Grid>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ export function Provider({ children }: Props): ReactElement {
|
|||||||
|
|
||||||
setStamps(stamps.filter(x => x.exists).map(enrichStamp))
|
setStamps(stamps.filter(x => x.exists).map(enrichStamp))
|
||||||
setLastUpdate(Date.now())
|
setLastUpdate(Date.now())
|
||||||
|
setError(null)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setError(e as Error)
|
setError(e as Error)
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ export async function sendRequest(
|
|||||||
const authorization = localStorage.getItem('apiKey')
|
const authorization = localStorage.getItem('apiKey')
|
||||||
|
|
||||||
if (!authorization) {
|
if (!authorization) {
|
||||||
throw Error('API key not found in local storage')
|
throw Error('API key not found in local storage. Please reopen via Swarm Desktop > Open Web UI.')
|
||||||
}
|
}
|
||||||
const headers = {
|
const headers = {
|
||||||
authorization,
|
authorization,
|
||||||
|
|||||||
Reference in New Issue
Block a user