-
+
+
+
{linkUrl ? (
{value}
@@ -84,8 +87,8 @@ const TransactionInfoItem = ({
)}
{valueTooltip && }
- {tag && {tag}
}
-
+ {tag &&
{tag}}
+
)
diff --git a/src/pages/Transaction/TransactionComp/styled.tsx b/src/pages/Transaction/TransactionComp/styled.tsx
index 375958425..1253dd95c 100644
--- a/src/pages/Transaction/TransactionComp/styled.tsx
+++ b/src/pages/Transaction/TransactionComp/styled.tsx
@@ -104,7 +104,6 @@ export const TransactionInfoItemPanel = styled.div`
}
.transactionInfoValue {
- margin-left: 10px;
margin-top: 5px;
max-height: 250px;
font-size: 16px;
@@ -121,6 +120,28 @@ export const TransactionInfoContentPanel = styled.div`
margin: 15px 0;
`
+export const TransactionInfoContentTitle = styled.div`
+ flex: 0 0 auto;
+ width: 160px;
+`
+
+export const TransactionInfoContentContainer = styled.div`
+ display: flex;
+
+ @media (max-width: 1150px) {
+ display: block;
+ }
+`
+
+export const TransactionInfoContentTag = styled.div`
+ margin-left: 10px;
+ margin-top: 3px;
+
+ @media (max-width: 1150px) {
+ margin-left: 0;
+ }
+`
+
export const TransactionInfoContentItem = styled.div`
display: flex;
margin: 5px 0;
diff --git a/src/utils/hook.ts b/src/utils/hook.ts
index 7f19c7b89..d03ea95ab 100644
--- a/src/utils/hook.ts
+++ b/src/utils/hook.ts
@@ -8,24 +8,15 @@ import {
systemScripts,
} from '@nervosnetwork/ckb-sdk-utils'
import { useHistory, useLocation } from 'react-router-dom'
-import { useQuery } from '@tanstack/react-query'
import { useResizeDetector } from 'react-resize-detector'
import { interval, share } from 'rxjs'
-import dayjs from 'dayjs'
import { deprecatedAddrToNewAddr } from './util'
import { startEndEllipsis } from './string'
-import {
- ListPageParams,
- PageParams,
- THEORETICAL_EPOCH_TIME,
- EPOCHS_PER_HALVING,
- ONE_YEAR_MILLISECOND,
- ONE_HOUR_MILLISECOND,
-} from '../constants/common'
+import { ListPageParams, PageParams, THEORETICAL_EPOCH_TIME, EPOCHS_PER_HALVING } from '../constants/common'
import { omit } from './object'
// TODO: This file depends on higher-level abstractions, so it should not be in the utils folder. It should be moved to `src/hooks/index.ts`.
import { useParseDate } from './date'
-import { Response, useStatistics } from '../services/ExplorerService'
+import { useStatistics } from '../services/ExplorerService'
import { cacheService } from '../services/CacheService'
/**
@@ -509,46 +500,6 @@ export const useDeprecatedAddr = (addr: string) =>
}
}, [addr])
-export function useChartQueryWithCache
(
- fetchData: () => Promise[]>>,
- cacheKey?: string,
- cacheMode: 'forever' | 'date' | 'epoch' = 'forever',
-) {
- return useQuery([fetchData, cacheKey, cacheMode], async () => {
- if (cacheKey) {
- const dataList = cacheService.get(cacheKey)
- if (dataList) return dataList
- }
-
- let dataList = await fetchData()
- if ('data' in dataList) {
- dataList = dataList.data.map(wrapper => wrapper.attributes)
- }
- if (cacheKey && dataList.length > 0) {
- let expireAt: Date | number
- switch (cacheMode) {
- case 'epoch':
- expireAt = Date.now() + ONE_HOUR_MILLISECOND * 3
- break
- case 'date': {
- // Chart data will be updated at 08:10(CST) every day
- const now = dayjs().utc()
- const todayUpdateTime = now.hour(8).minute(11).second(0).millisecond(0)
- const nextUpdateTime = now.isBefore(todayUpdateTime) ? todayUpdateTime : todayUpdateTime.add(1, 'day')
- expireAt = nextUpdateTime.toDate()
- break
- }
- case 'forever':
- default:
- expireAt = Date.now() + ONE_YEAR_MILLISECOND * 100
- break
- }
- cacheService.set(cacheKey, dataList, { expireAt })
- }
- return dataList
- })
-}
-
export const useAnimationFrame = (callback: () => void, running: boolean = true) => {
const savedCallback = useRef(callback)
diff --git a/src/utils/number.ts b/src/utils/number.ts
index e96fc7e46..987ebc6ea 100644
--- a/src/utils/number.ts
+++ b/src/utils/number.ts
@@ -79,7 +79,7 @@ export const parseUDTAmount = (amount: string, decimal: string | number) => {
if (decimalInt > 20) {
return `${result.toFixed(20)}...`
}
- if (result.toString().length >= 16 || result.lt(new BigNumber(0.000001))) {
+ if (result.toString().length >= 16 || result.abs().lt(new BigNumber(0.000001))) {
return localeNumberString(result.toFixed(decimalInt))
}
return localeNumberString(result.toNumber())
diff --git a/yarn.lock b/yarn.lock
index 695c394fa..79e1dd6f2 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2656,10 +2656,10 @@
resolved "https://registry.yarnpkg.com/@types/deep-freeze-strict/-/deep-freeze-strict-1.1.0.tgz#447a6a2576191344aa42310131dd3df5c41492c4"
integrity sha512-fILflsS66kGQ4iIBzYoxuQCWK1wQdy/ooguTofUk0KSxA+G5ZzH8WdU8mf6IU+5cMBW+j9u+eh+7kv63R3O9Tw==
-"@types/echarts@4.9.19":
- version "4.9.19"
- resolved "https://registry.yarnpkg.com/@types/echarts/-/echarts-4.9.19.tgz#6c50ccde9f4458edfc36a9c78f81511ec1853941"
- integrity sha512-mtQzTmBFLQ1tyAmP667OTr7oOceyfqHRMa0tkIj9FBOKYY0ggG6OGE4AfUtDw2gOuPEEw4vzD+y0OJWKi1IZHQ==
+"@types/echarts@4.9.21":
+ version "4.9.21"
+ resolved "https://registry.yarnpkg.com/@types/echarts/-/echarts-4.9.21.tgz#9626d0db7215cf51cbfe02a42c05d9d2834f243a"
+ integrity sha512-xUvHN2TbednNO3bybnG8GtOWU/f+/ouSlC9wO+704uiRlVtPEcLPfvfD24WqZ8uAXJ2dvlBLeB60WIlzv+Xajw==
dependencies:
"@types/zrender" "*"
@@ -2842,10 +2842,10 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.11.0.tgz#390ea202539c61c8fa6ba4428b57e05bc36dc47b"
integrity sha512-uM4mnmsIIPK/yeO+42F2RQhGUIs39K2RFmugcJANppXe6J1nvH87PvzPZYpza7Xhhs8Yn9yIAVdLZ84z61+0xQ==
-"@types/node@16.18.58":
- version "16.18.58"
- resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.58.tgz#bf66f63983104ed57c754f4e84ccaf16f8235adb"
- integrity sha512-YGncyA25/MaVtQkjWW9r0EFBukZ+JulsLcVZBlGUfIb96OBMjkoRWwQo5IEWJ8Fj06Go3GHw+bjYDitv6BaGsA==
+"@types/node@16.18.61":
+ version "16.18.61"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.61.tgz#5ea47e3018348bf3bbbe646b396ba5e720310be1"
+ integrity sha512-k0N7BqGhJoJzdh6MuQg1V1ragJiXTh8VUBAZTWjJ9cUq23SG0F0xavOwZbhiP4J3y20xd6jxKx+xNUhkMAi76Q==
"@types/normalize-package-data@^2.4.0":
version "2.4.1"