Skip to content

Commit

Permalink
feat(neuron-ui): use tooltip component instead of element title to di…
Browse files Browse the repository at this point in the history
…splay the sync progress.
  • Loading branch information
Keith-CY committed Oct 28, 2019
1 parent c5b5c86 commit 6780d45
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions packages/neuron-ui/src/containers/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useCallback, useContext } from 'react'
import { createPortal } from 'react-dom'
import { RouteComponentProps } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { Stack, getTheme, Text, ProgressIndicator, Icon } from 'office-ui-fabric-react'
import { Stack, getTheme, Text, ProgressIndicator, Icon, TooltipHost } from 'office-ui-fabric-react'

import { StateWithDispatch } from 'states/stateProvider/reducer'
import { ConnectionStatus, FULL_SCREENS, Routes } from 'utils/const'
Expand Down Expand Up @@ -33,20 +33,19 @@ export const SyncStatus = ({

const percentage = +syncedBlockNumber / +tipBlockNumber

return (
<div style={{ display: 'flex', alignItems: 'center' }} title={`${syncedBlockNumber} / ${tipBlockNumber}`}>
{+syncedBlockNumber + bufferBlockNumber < +tipBlockNumber ? (
<>
{t('sync.syncing')}
<ProgressIndicator
percentComplete={percentage}
styles={{ root: { width: '120px', marginLeft: '5px', marginRight: '5px' } }}
/>
</>
) : (
<>{t('sync.synced')}</>
)}
</div>
return +syncedBlockNumber + bufferBlockNumber < +tipBlockNumber ? (
<TooltipHost
content={`${syncedBlockNumber} / ${tipBlockNumber}`}
styles={{ root: { display: 'flex', justifyContent: 'center', alignItems: 'center' } }}
>
{t('sync.syncing')}
<ProgressIndicator
percentComplete={percentage}
styles={{ root: { width: '120px', marginLeft: '5px', marginRight: '5px' } }}
/>
</TooltipHost>
) : (
<>{t('sync.synced')}</>
)
}

Expand Down

0 comments on commit 6780d45

Please sign in to comment.