Skip to content

Commit

Permalink
feat: hostd node show network block height
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Sep 21, 2023
1 parent 391963e commit 05e094c
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions apps/hostd/components/Node/index.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
import { DatumCard, PeerList } from '@siafoundation/design-system'
import { useStateConsensus, useSyncerPeers } from '@siafoundation/react-hostd'
import { useSyncerPeers } from '@siafoundation/react-hostd'
import { routes } from '../../config/routes'
import { useDialog } from '../../contexts/dialog'
import { HostdSidenav } from '../HostdSidenav'
import { HostdAuthedLayout } from '../HostdAuthedLayout'
import { useMemo } from 'react'
import { orderBy } from 'lodash'
import { useSyncStatus } from '../../hooks/useSyncStatus'

export function Node() {
const peers = useSyncerPeers()
const state = useStateConsensus({
config: {
swr: {
refreshInterval: 30_000,
},
},
})
const syncStatus = useSyncStatus()
const { openDialog } = useDialog()

const peerList = useMemo(() => {
Expand All @@ -37,11 +32,15 @@ export function Node() {
<DatumCard
label="Height"
value={
state.data
? state.data.chainIndex.height.toLocaleString()
syncStatus.nodeBlockHeight
? syncStatus.nodeBlockHeight.toLocaleString()
: undefined
}
comment={
!syncStatus.isSynced
? `Syncing to ${syncStatus.estimatedBlockHeight.toLocaleString()}`
: undefined
}
comment={!state.data?.synced ? 'Syncing' : undefined}
/>
<DatumCard label="Connected peers" value={peers.data?.length} />
</div>
Expand Down

0 comments on commit 05e094c

Please sign in to comment.