diff --git a/package.json b/package.json index 9d8b788387..e2ae7c3e57 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "@babel/core": "7.17.10", "@types/jest": "27.5.0", "@types/node": "16.11.7", + "@types/npmlog": "4.1.2", "@typescript-eslint/eslint-plugin": "5.23.0", "@typescript-eslint/parser": "5.23.0", "concurrently": "7.0.0", diff --git a/packages/neuron-ui/src/components/CompensationPeriodTooltip/index.tsx b/packages/neuron-ui/src/components/CompensationPeriodTooltip/index.tsx index 1ca7463ea8..5b7a9b332c 100644 --- a/packages/neuron-ui/src/components/CompensationPeriodTooltip/index.tsx +++ b/packages/neuron-ui/src/components/CompensationPeriodTooltip/index.tsx @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next' import { getCompensatedTime, getCompensationPeriod, CONSTANTS, CompensationPeriod, uniformTimeFormatter } from 'utils' import styles from './compensationPeriodTooltip.module.scss' -const { WITHDRAW_EPOCHS, IMMATURE_EPOCHS } = CONSTANTS +const { WITHDRAW_EPOCHS } = CONSTANTS const HOUR = 3_600_000 const HOURS_PER_EPOCH = 4 * HOUR @@ -47,22 +47,6 @@ const CompensationPeriodTooltip = ({ endEpochTimestamp - (1 - CompensationPeriod.REQUEST_START) * WITHDRAW_EPOCHS * HOURS_PER_EPOCH const { days, hours } = getCompensatedTime({ currentEpochValue: baseEpochValue, depositEpochValue }) - const isImmature = baseEpochValue < depositEpochValue + IMMATURE_EPOCHS - - if (isImmature) { - return ( -
-
- {t('nervos-dao.compensation-period.tooltip.compensated-period')} - {t('nervos-dao.compensation-period.tooltip.days-hours', { days, hours })} -
-
-
-
{t('nervos-dao.compensation-period.tooltip.immature-for-withdraw')}
-
-
- ) - } let stage = 'normal' if (baseEpochTimestamp > endingStartEpochTimestamp) { diff --git a/packages/neuron-ui/src/components/NervosDAORecord/index.tsx b/packages/neuron-ui/src/components/NervosDAORecord/index.tsx index 5864b6ca6d..ed41668389 100644 --- a/packages/neuron-ui/src/components/NervosDAORecord/index.tsx +++ b/packages/neuron-ui/src/components/NervosDAORecord/index.tsx @@ -6,7 +6,6 @@ import CopyZone from 'widgets/CopyZone' import { calculateClaimEpochValue, ConnectionStatus, - CONSTANTS, shannonToCKBFormatter, uniformTimeFormatter, getDAOCellStatus, @@ -18,8 +17,6 @@ import CompensationPeriodTooltip from 'components/CompensationPeriodTooltip' import styles from './daoRecordRow.module.scss' import hooks from './hooks' -const { IMMATURE_EPOCHS, HOURS_PER_EPOCH } = CONSTANTS - const EPOCHS_PER_DAY = 6 const getDaysAndHours = (seconds: number) => { @@ -122,30 +119,10 @@ export const DAORecord = ({ message = t('nervos-dao.compensation-period.stage-messages.pending') break } - case CellStatus.ImmatureForWithdraw: { - let hours: string | number = (depositEpochValue + IMMATURE_EPOCHS - currentEpochValue) * HOURS_PER_EPOCH - if (Number.isNaN(hours) || hours < 0 || hours > HOURS_PER_EPOCH * IMMATURE_EPOCHS) { - hours = '--' - } else { - hours = hours.toFixed(1) - } - message = t('nervos-dao.compensation-period.stage-messages.immature-for-withdraw', { hours }) - break - } case CellStatus.Deposited: { message = t('nervos-dao.compensation-period.stage-messages.next-compensation-cycle', { days: leftDays || '--' }) break } - case CellStatus.ImmatureForUnlock: { - let hours: number | string = (compensationEndEpochValue + IMMATURE_EPOCHS - currentEpochValue) * HOURS_PER_EPOCH - if (Number.isNaN(hours) || hours < 0 || hours > HOURS_PER_EPOCH * IMMATURE_EPOCHS) { - hours = '--' - } else { - hours = hours.toFixed(1) - } - message = t('nervos-dao.compensation-period.stage-messages.immature-for-unlock', { hours }) - break - } case CellStatus.Locked: { message = t('nervos-dao.compensation-period.stage-messages.compensation-cycle-will-end', { days: leftDays || '--', @@ -186,7 +163,7 @@ export const DAORecord = ({ <>