Skip to content

Commit

Permalink
feat: hide empty epoch time and epoch length because they are
Browse files Browse the repository at this point in the history
invalid
  • Loading branch information
Keith-CY committed Nov 7, 2023
1 parent 462122c commit dce76b1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pages/StatisticsChart/mining/DifficultyUncleRateEpoch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ const widthSpan = (value: string, currentLanguage: LanuageType) =>
const useTooltip = () => {
const { t } = useTranslation()
const currentLanguage = useCurrentLanguage()
return ({ seriesName, data, color }: SeriesItem & { data?: number }) => {
if (seriesName === t('block.epoch_time') && typeof data === 'number') {
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') && typeof data === 'number') {
// 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

0 comments on commit dce76b1

Please sign in to comment.