From 8c10ddd171bd9079c913f9a9cb1f2a7a3e278302 Mon Sep 17 00:00:00 2001 From: Danh Date: Tue, 3 Oct 2023 11:30:27 +0700 Subject: [PATCH] chore: use kyberscore/tag p2 --- .../TrueSightV2/components/SearchWithDropDown.tsx | 5 ++--- .../components/SmallKyberScoreMeter.tsx | 15 ++++----------- src/pages/TrueSightV2/components/table/index.tsx | 12 ++++-------- src/pages/TrueSightV2/pages/TokenAnalysisList.tsx | 5 ++--- 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/pages/TrueSightV2/components/SearchWithDropDown.tsx b/src/pages/TrueSightV2/components/SearchWithDropDown.tsx index 8f7e4df50e..bb6d530791 100644 --- a/src/pages/TrueSightV2/components/SearchWithDropDown.tsx +++ b/src/pages/TrueSightV2/components/SearchWithDropDown.tsx @@ -25,7 +25,6 @@ import { formatTokenPrice } from '../utils' import WatchlistButton from './WatchlistButton' const formatTokenType = (token: ITokenList): ITokenSearchResult => { - const kyberScore3D = token.kyberScore3D?.[token.kyberScore3D.length - 1] return { assetId: token.assetId, name: token.name, @@ -34,8 +33,8 @@ const formatTokenType = (token: ITokenList): ITokenSearchResult => { price: token.price, priceChange24h: token.priceChange24H, kyberScore: { - score: kyberScore3D?.kyberScore || 0, - label: kyberScore3D?.tag || '', + score: token.kyberScore || 0, + label: token.kyberScoreTag || '', }, } } diff --git a/src/pages/TrueSightV2/components/SmallKyberScoreMeter.tsx b/src/pages/TrueSightV2/components/SmallKyberScoreMeter.tsx index 0823a383b8..8607084f07 100644 --- a/src/pages/TrueSightV2/components/SmallKyberScoreMeter.tsx +++ b/src/pages/TrueSightV2/components/SmallKyberScoreMeter.tsx @@ -27,15 +27,8 @@ const GaugeValue = styled.div` justify-content: center; bottom: 6px; ` -function SmallKyberScoreMeter({ - data, - disabledTooltip, - token, -}: { - data?: IKyberScoreChart - disabledTooltip?: boolean - token: ITokenList -}) { +function SmallKyberScoreMeter({ disabledTooltip, token }: { disabledTooltip?: boolean; token: ITokenList }) { + const data: IKyberScoreChart | undefined = token?.kyberScore3D?.[token.kyberScore3D.length - 1] const value = token?.kyberScore const theme = useTheme() const emptyColor = theme.darkMode ? theme.subText + '30' : theme.border + '60' @@ -69,11 +62,11 @@ function SmallKyberScoreMeter({ KyberScore:{' '} - {value || '--'} ({data.tag || t`Not Applicable`}) + {value || '--'} ({token.kyberScoreTag || t`Not Applicable`}) - Token Price: {formatTokenPrice(data.price || 0)} + Token Price: {formatTokenPrice(token.price || 0)} ) : ( diff --git a/src/pages/TrueSightV2/components/table/index.tsx b/src/pages/TrueSightV2/components/table/index.tsx index 32321464d2..4caab24b73 100644 --- a/src/pages/TrueSightV2/components/table/index.tsx +++ b/src/pages/TrueSightV2/components/table/index.tsx @@ -25,7 +25,7 @@ import { NETWORK_IMAGE_URL, NETWORK_TO_CHAINID, Z_INDEX_KYBER_AI } from 'pages/T import useKyberAIAssetOverview from 'pages/TrueSightV2/hooks/useKyberAIAssetOverview' import { useFundingRateQuery, useHolderListQuery, useLiveDexTradesQuery } from 'pages/TrueSightV2/hooks/useKyberAIData' import { TechnicalAnalysisContext } from 'pages/TrueSightV2/pages/TechnicalAnalysis' -import { IHolderList, IKyberScoreChart, ILiveTrade, ITokenList, KyberAITimeframe } from 'pages/TrueSightV2/types' +import { IHolderList, ILiveTrade, ITokenList, KyberAITimeframe } from 'pages/TrueSightV2/types' import { calculateValueToColor, formatLocaleStringNum, @@ -580,7 +580,6 @@ const WidgetTokenRow = ({ const theme = useTheme() const navigate = useNavigate() - const latestKyberScore: IKyberScoreChart | undefined = token?.kyberScore3D?.[token.kyberScore3D.length - 1] const hasMutipleChain = token?.addresses?.length > 1 const [showSwapMenu, setShowSwapMenu] = useState(false) @@ -689,9 +688,9 @@ const WidgetTokenRow = ({ - + - {latestKyberScore?.tag || t`Not Applicable`} + {token?.kyberScoreTag || t`Not Applicable`} @@ -1105,7 +1104,6 @@ export const TokenListInShareModalTable = ({ {data.map((token, index) => { - const latestKyberscore = token.kyberScore3D ? token.kyberScore3D[token.kyberScore3D.length - 1] : null return ( {index + 1 + startIndex} @@ -1147,9 +1145,7 @@ export const TokenListInShareModalTable = ({ {!mobileMode && ( - - {latestKyberscore?.kyberScore} - + {token?.kyberScore} )} diff --git a/src/pages/TrueSightV2/pages/TokenAnalysisList.tsx b/src/pages/TrueSightV2/pages/TokenAnalysisList.tsx index 8da68d17e7..f924efb882 100644 --- a/src/pages/TrueSightV2/pages/TokenAnalysisList.tsx +++ b/src/pages/TrueSightV2/pages/TokenAnalysisList.tsx @@ -520,7 +520,6 @@ const TokenRow = React.memo(function TokenRow({ }) } - const latestKyberScore: IKyberScoreChart | undefined = token?.kyberScore3D?.[token.kyberScore3D.length - 1] return ( @@ -557,9 +556,9 @@ const TokenRow = React.memo(function TokenRow({ - + - {latestKyberScore?.tag || 'Not Applicable'} + {token?.kyberScoreTag || 'Not Applicable'}