Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop into testnet #1376

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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