Skip to content

Commit

Permalink
fix: pr
Browse files Browse the repository at this point in the history
  • Loading branch information
devchenyan committed Jul 27, 2023
1 parent 5d3f100 commit db4c58e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
7 changes: 3 additions & 4 deletions packages/neuron-ui/src/components/SpecialAssetList/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
useDialogWrapper,
useDidMount,
} from 'utils'
import { MILLISECONDS } from 'utils/const'
import { MILLISECONDS, MILLISECONDS_PER_DAY } from 'utils/const'
import { AssetInfo, ChequeAssetInfo, NFTType } from '.'

export const useMigrate = () => {
Expand Down Expand Up @@ -143,8 +143,7 @@ export const useGetSpecialAssetColumnInfo = ({
status = (assetInfo as ChequeAssetInfo).data === 'claimable' ? 'claim-asset' : 'withdraw-asset'

if (status === 'withdraw-asset') {
const DAY = 86_400_000
targetTime = datetime + DAY
targetTime = datetime + MILLISECONDS_PER_DAY
}

try {
Expand All @@ -171,7 +170,7 @@ export const useGetSpecialAssetColumnInfo = ({
}
}

const isLockedCheque = status === 'withdraw-asset' && Date.now() < targetTime!
const isLockedCheque = status === 'withdraw-asset' && targetTime && Date.now() < targetTime
const isNFTTransferable = assetInfo.type === NFTType.NFT && assetInfo.data === 'transferable'
const isNFTClassOrIssuer = assetInfo.type === NFTType.NFTClass || assetInfo.type === NFTType.NFTIssuer

Expand Down
6 changes: 5 additions & 1 deletion packages/neuron-ui/src/utils/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export const SHANNON_CKB_RATIO = 1e8

export const MEDIUM_FEE_RATE = 2000
export const WITHDRAW_EPOCHS = 180
export const MILLISECONDS_IN_YEAR = 365 * 24 * 3600 * 1000
export const MILLISECONDS_PER_DAY = 24 * 3600 * 1000
export const MILLISECONDS_IN_YEAR = 365 * MILLISECONDS_PER_DAY
export const HOURS_PER_EPOCH = 4
export const HOURS_PER_DAY = 24

Expand Down Expand Up @@ -71,3 +72,6 @@ export const METHOD_NOT_FOUND = -32601

export const MAX_M_N_NUMBER = 255
export const MILLISECONDS = HOURS_PER_EPOCH * 60 * 60 * 1000

export const ADDRESS_MIN_LENGTH = 86
export const ADDRESS_HEAD_TAIL_LENGTH = 34
5 changes: 4 additions & 1 deletion packages/neuron-ui/src/widgets/InputSelect/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useRef, useState, useEffect, useCallback } from 'react'
import { useDidMount, useForceUpdate } from 'utils'
import { ADDRESS_MIN_LENGTH, ADDRESS_HEAD_TAIL_LENGTH } from 'utils/const'
import { ReactComponent as Arrow } from 'widgets/Icons/Arrow.svg'

import styles from './input-select.module.scss'
Expand Down Expand Up @@ -88,7 +89,9 @@ const Select = ({ value, options, placeholder, disabled, onChange, className, in
aria-selected={isSelected ? 'true' : 'false'}
aria-hidden="true"
>
{typeof label === 'string' && label?.length > 68 ? `${label.slice(0, 34)}...${label.slice(-34)}` : label}
{typeof label === 'string' && label?.length > ADDRESS_MIN_LENGTH
? `${label.slice(0, ADDRESS_HEAD_TAIL_LENGTH)}...${label.slice(-ADDRESS_HEAD_TAIL_LENGTH)}`
: label}
</div>
)
},
Expand Down

0 comments on commit db4c58e

Please sign in to comment.