Skip to content

Commit

Permalink
use kyberScore field
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoaidanh committed Oct 3, 2023
1 parent e511c8a commit f93f005
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
18 changes: 13 additions & 5 deletions src/pages/TrueSightV2/components/SmallKyberScoreMeter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Column from 'components/Column'
import Icon from 'components/Icons/Icon'
import { RowFit } from 'components/Row'

import { IKyberScoreChart } from '../types'
import { IKyberScoreChart, ITokenList } from '../types'
import { calculateValueToColor, formatTokenPrice } from '../utils'
import { gaugeList } from './KyberScoreMeter'
import SimpleTooltip from './SimpleTooltip'
Expand All @@ -27,8 +27,16 @@ const GaugeValue = styled.div`
justify-content: center;
bottom: 6px;
`
function SmallKyberScoreMeter({ data, disabledTooltip }: { data?: IKyberScoreChart; disabledTooltip?: boolean }) {
const value = data?.kyberScore
function SmallKyberScoreMeter({
data,
disabledTooltip,
token,
}: {
data?: IKyberScoreChart
disabledTooltip?: boolean
token: ITokenList
}) {
const value = token?.kyberScore
const theme = useTheme()
const emptyColor = theme.darkMode ? theme.subText + '30' : theme.border + '60'
const activeGaugeValue = value ? (gaugeList.length * value) / 100 : 0
Expand Down Expand Up @@ -60,8 +68,8 @@ function SmallKyberScoreMeter({ data, disabledTooltip }: { data?: IKyberScoreCha
</Text>
<Text>
KyberScore:{' '}
<span style={{ color: calculateValueToColor(data.kyberScore || 0, theme) }}>
{data.kyberScore || '--'} ({data.tag || t`Not Applicable`})
<span style={{ color: calculateValueToColor(value || 0, theme) }}>
{value || '--'} ({data.tag || t`Not Applicable`})
</span>
</Text>
<Text>
Expand Down
8 changes: 2 additions & 6 deletions src/pages/TrueSightV2/components/table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -689,12 +689,8 @@ const WidgetTokenRow = ({
</td>
<td>
<Column style={{ alignItems: 'center', width: '110px' }}>
<SmallKyberScoreMeter data={latestKyberScore} disabledTooltip={token.symbol === 'KNC'} />
<Text
color={calculateValueToColor(latestKyberScore?.kyberScore || 0, theme)}
fontSize="14px"
fontWeight={500}
>
<SmallKyberScoreMeter data={latestKyberScore} token={token} disabledTooltip={token.symbol === 'KNC'} />
<Text color={calculateValueToColor(token.kyberScore || 0, theme)} fontSize="14px" fontWeight={500}>
{latestKyberScore?.tag || t`Not Applicable`}
</Text>
</Column>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/TrueSightV2/hooks/useKyberAIData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const kyberAIApi = createApi({
...DEFAULT_PARAMS_BY_TAB[type as KyberAIListType],
...filterSort,
page: page || 1,
size: pageSize || 10,
pageSize: pageSize || 10,
keywords,
},
}),
Expand Down
8 changes: 2 additions & 6 deletions src/pages/TrueSightV2/pages/TokenAnalysisList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,8 @@ const TokenRow = React.memo(function TokenRow({
</td>
<td>
<Column style={{ alignItems: 'center', width: '110px' }}>
<SmallKyberScoreMeter data={latestKyberScore} />
<Text
color={calculateValueToColor(latestKyberScore?.kyberScore || 0, theme)}
fontSize="14px"
fontWeight={500}
>
<SmallKyberScoreMeter data={latestKyberScore} token={token} />
<Text color={calculateValueToColor(token.kyberScore || 0, theme)} fontSize="14px" fontWeight={500}>
{latestKyberScore?.tag || 'Not Applicable'}
</Text>
</Column>
Expand Down

0 comments on commit f93f005

Please sign in to comment.