Skip to content

Commit

Permalink
add less than symbol for small amounts
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigoncalves committed Sep 27, 2023
1 parent cbd8f66 commit 13db0c9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/token/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const TokenBalance = ({
{'<'}
</Typography>
)}
<DollarIcon size={16} color={sharedColors.subTitle} />
<DollarIcon size={16} color={sharedColors.labelLight} />
</>
)}
{!isNaN(Number(secondValue?.balance)) && (
Expand Down
5 changes: 1 addition & 4 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ export const roundBalance = (num: number, decimalPlaces?: number) => {
}

export const displayRoundBalance = (num: number): string => {
let rounded = roundBalance(num, 4)
if (!rounded) {
rounded = roundBalance(num, 8)
}
const rounded = roundBalance(num, 4) || roundBalance(num, 8)
return rounded.toString()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ export const TransactionSummaryComponent = ({
</View>
</View>
<View style={styles.dollarAmountWrapper}>
{usdValue.symbol === '<' && (
<Typography type="body1" color={sharedColors.labelLight}>
{'<'}
</Typography>
)}
<DollarIcon size={14} color={sharedColors.labelLight} />
<Typography
type={'body2'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export const ReviewTransactionContainer = ({
// get usd values
const tokenUsd = convertToUSD(Number(value), tokenQuote)
const feeUsd = convertToUSD(Number(feeValue), feeQuote)
const smallAmount = !Number(tokenUsd) && !!Number(value)
const isAmountSmall = !Number(tokenUsd) && !!Number(value)

return {
transaction: {
Expand All @@ -197,9 +197,9 @@ export const ReviewTransactionContainer = ({
balance: value.toString(),
},
usdValue: {
symbol: smallAmount ? '<' : '$',
symbol: isAmountSmall ? '<' : '$',
symbolType: 'usd',
balance: smallAmount ? '0.01' : tokenUsd,
balance: isAmountSmall ? '0.01' : tokenUsd,
},
fee: {
tokenValue: feeValue,
Expand Down

0 comments on commit 13db0c9

Please sign in to comment.