Skip to content

Commit

Permalink
Merge pull request #1376 from nervosnetwork/develop
Browse files Browse the repository at this point in the history
Merge develop into testnet
  • Loading branch information
Keith-CY authored Nov 7, 2023
2 parents d1cf553 + c438379 commit e74c370
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/pages/StatisticsChart/mining/DifficultyUncleRateEpoch.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FC } from 'react'
import BigNumber from 'bignumber.js'
import { useTranslation } from 'react-i18next'
import { assertSerialsDataIsString, assertIsArray, assertSerialsItem, handleAxis } from '../../../utils/chart'
import { assertIsArray, assertSerialsItem, handleAxis } from '../../../utils/chart'
import { tooltipColor, tooltipWidth, SeriesItem, SmartChartPage } from '../common'
import { parseHourFromMillisecond } from '../../../utils/date'
import { ChartItem, explorerService } from '../../../services/ExplorerService'
Expand All @@ -14,11 +14,13 @@ const widthSpan = (value: string, currentLanguage: SupportedLng) =>
const useTooltip = () => {
const { t } = useTranslation()
const currentLanguage = useCurrentLanguage()
return ({ seriesName, data, color }: SeriesItem & { data: string }) => {
if (seriesName === t('block.epoch_time')) {
return ({ seriesName, data, color }: SeriesItem & { data?: unknown }) => {
// empty epoch time is invalid and could be hidden, epoch time is expected to be around 4 hours
if (seriesName === t('block.epoch_time') && data) {
return `<div>${tooltipColor(color)}${widthSpan(t('block.epoch_time'), currentLanguage)} ${data} h</div>`
}
if (seriesName === t('block.epoch_length')) {
// empty epoch length is invalid and could be hidden, epoch length is determined by avg block time, it's expected to be 4h / avg_block_time
if (seriesName === t('block.epoch_length') && data) {
return `<div>${tooltipColor(color)}${widthSpan(t('block.epoch_length'), currentLanguage)} ${data}</div>`
}
return ''
Expand Down Expand Up @@ -70,7 +72,6 @@ const useOption = (
}</div>`
dataList.forEach(data => {
assertSerialsItem(data)
assertSerialsDataIsString(data)
result += parseTooltip(data)
})
return result
Expand Down

0 comments on commit e74c370

Please sign in to comment.