feat: remove the last update component (#179)

This commit is contained in:
Vojtech Simetka
2021-08-23 16:00:22 +02:00
committed by GitHub
parent 7f2ff39ec9
commit 56df3a2561
4 changed files with 3 additions and 41 deletions
-23
View File
@@ -1,23 +0,0 @@
import { ReactElement, useEffect, useState } from 'react'
interface Props {
date: number | null
}
export default function LastUpdate({ date }: Props): ReactElement {
const [duration, setDuration] = useState<string>('never')
const refresh = () => {
if (!date) setDuration('never')
else setDuration(`${((Date.now() - date) / 1000).toFixed()} seconds ago`)
}
useEffect(() => {
refresh()
const i = setInterval(refresh, 1000)
return () => clearInterval(i)
}, [date])
return <span>Last Update: {duration}</span>
}
-6
View File
@@ -9,8 +9,6 @@ import { Activity, FileText, DollarSign, Share2, Settings, Layers } from 'react-
import SwarmLogoOrange from '../assets/swarm-logo-orange.svg'
import { Health } from '@ethersphere/bee-js'
import LastUpdate from './LastUpdate'
const drawerWidth = 240
const navBarItems = [
@@ -87,7 +85,6 @@ interface Props extends RouteComponentProps {
themeMode: string
health: boolean
nodeHealth: Health | null
lastUpdate: number | null
}
export default function SideBar(props: Props): ReactElement {
@@ -170,9 +167,6 @@ export default function SideBar(props: Props): ReactElement {
<span>Debug API</span>
</div>
</ListItem>
<div style={{ width: '100%', textAlign: 'center' }}>
<LastUpdate date={props.lastUpdate} />
</div>
</div>
</Drawer>
</div>
+2 -9
View File
@@ -33,8 +33,7 @@ const Dashboard = (props: Props): ReactElement => {
const [themeMode, toggleThemeMode] = useState('light')
// FIXME: handle errrors and loading
const { isLoading, lastUpdate, apiHealth, debugApiHealth } = useContext(Context)
const { isLoading, apiHealth, debugApiHealth } = useContext(Context)
useEffect(() => {
const theme = localStorage.getItem('theme')
@@ -57,13 +56,7 @@ const Dashboard = (props: Props): ReactElement => {
return (
<div>
<SideBar
{...props}
themeMode={themeMode}
health={apiHealth}
nodeHealth={debugApiHealth}
lastUpdate={lastUpdate}
/>
<SideBar {...props} themeMode={themeMode} health={apiHealth} nodeHealth={debugApiHealth} />
<NavBar themeMode={themeMode} />
<ErrorBoundary>
<main className={classes.content}>
+1 -3
View File
@@ -5,7 +5,6 @@ import { Container, CircularProgress } from '@material-ui/core'
import StampsTable from './StampsTable'
import TroubleshootConnectionCard from '../../components/TroubleshootConnectionCard'
import CreatePostageStampModal from './CreatePostageStampModal'
import LastUpdate from '../../components/LastUpdate'
import { Context } from '../../providers/Stamps'
import { Context as BeeContext } from '../../providers/Bee'
@@ -33,7 +32,7 @@ export default function Accounting(): ReactElement {
const classes = useStyles()
const beeContext = useContext(BeeContext)
const { stamps, isLoading, error, lastUpdate, start, stop } = useContext(Context)
const { stamps, isLoading, error, start, stop } = useContext(Context)
useEffect(() => {
start()
@@ -61,7 +60,6 @@ export default function Accounting(): ReactElement {
<>
<div className={classes.actions}>
<CreatePostageStampModal />
<LastUpdate date={lastUpdate} />
<div style={{ height: '5px' }}>{isLoading && <CircularProgress />}</div>
</div>
<StampsTable postageStamps={stamps} />