1- import { DiscIcon } from "@radix-ui/react-icons" ;
21import { useMemo , useState } from "react" ;
32import type { Token } from "../../../../../bridge/index.js" ;
43import type { BridgeChain } from "../../../../../bridge/types/Chain.js" ;
54import type { ThirdwebClient } from "../../../../../client/client.js" ;
65import { toTokens } from "../../../../../utils/units.js" ;
6+ import { useCustomTheme } from "../../../../core/design-system/CustomThemeProvider.js" ;
77import {
88 fontSize ,
99 iconSize ,
@@ -12,15 +12,13 @@ import {
1212} from "../../../../core/design-system/index.js" ;
1313import { CoinsIcon } from "../../ConnectWallet/icons/CoinsIcon.js" ;
1414import { WalletDotIcon } from "../../ConnectWallet/icons/WalletDotIcon.js" ;
15- import { formatTokenAmount } from "../../ConnectWallet/screens/formatTokenBalance.js" ;
1615import { Container , Line , ModalHeader } from "../../components/basic.js" ;
1716import { Button } from "../../components/buttons.js" ;
1817import { Img } from "../../components/Img.js" ;
1918import { Skeleton } from "../../components/Skeleton.js" ;
2019import { Spacer } from "../../components/Spacer.js" ;
2120import { Spinner } from "../../components/Spinner.js" ;
2221import { Text } from "../../components/text.js" ;
23- import { DecimalRenderer } from "./common.js" ;
2422import { SearchInput } from "./SearchInput.js" ;
2523import { SelectChainButton } from "./SelectChainButton.js" ;
2624import { SelectBridgeChain } from "./select-chain.js" ;
@@ -31,6 +29,7 @@ import {
3129 useTokenBalances ,
3230 useTokens ,
3331} from "./use-tokens.js" ;
32+ import { tokenAmountFormatter } from "./utils.js" ;
3433
3534/**
3635 * @internal
@@ -398,6 +397,7 @@ function TokenButton(props: {
398397 onSelect : ( tokenWithPrices : TokenSelection ) => void ;
399398 isSelected : boolean ;
400399} ) {
400+ const theme = useCustomTheme ( ) ;
401401 const tokenBalanceInUnits =
402402 "balance" in props . token
403403 ? toTokens ( BigInt ( props . token . balance ) , props . token . decimals )
@@ -451,7 +451,14 @@ function TokenButton(props: {
451451 } }
452452 fallback = {
453453 < Container color = "secondaryText" >
454- < DiscIcon width = { iconSize . lg } height = { iconSize . lg } />
454+ < Container
455+ style = { {
456+ background : `linear-gradient(45deg, white, ${ theme . colors . accentText } )` ,
457+ borderRadius : radius . full ,
458+ width : `${ iconSize . lg } px` ,
459+ height : `${ iconSize . lg } px` ,
460+ } }
461+ />
455462 </ Container >
456463 }
457464 />
@@ -470,21 +477,18 @@ function TokenButton(props: {
470477 width : "100%" ,
471478 } }
472479 >
473- < Text size = "md" color = "primaryText" weight = { 500 } >
480+ < Text size = "md" color = "primaryText" >
474481 { props . token . symbol }
475482 </ Text >
483+
476484 { "balance" in props . token && (
477- < DecimalRenderer
478- integerSize = "md"
479- fractionSize = "sm"
480- value = { formatTokenAmount (
481- BigInt ( props . token . balance ) ,
482- props . token . decimals ,
483- 3 ,
485+ < Text size = "md" color = "primaryText" >
486+ { tokenAmountFormatter . format (
487+ Number (
488+ toTokens ( BigInt ( props . token . balance ) , props . token . decimals ) ,
489+ ) ,
484490 ) }
485- color = "primaryText"
486- weight = { 500 }
487- />
491+ </ Text >
488492 ) }
489493 </ Container >
490494 < Container
@@ -495,9 +499,8 @@ function TokenButton(props: {
495499 } }
496500 >
497501 < Text
498- size = "sm "
502+ size = "xs "
499503 color = "secondaryText"
500- weight = { 400 }
501504 style = { {
502505 overflow : "hidden" ,
503506 textOverflow : "ellipsis" ,
@@ -509,16 +512,9 @@ function TokenButton(props: {
509512 </ Text >
510513 { usdValue && (
511514 < Container flex = "row" >
512- < Text size = "sm " color = "secondaryText" weight = { 400 } >
513- $
515+ < Text size = "xs " color = "secondaryText" weight = { 400 } >
516+ ${ usdValue . toFixed ( 2 ) }
514517 </ Text >
515- < DecimalRenderer
516- value = { usdValue . toFixed ( 2 ) }
517- color = "secondaryText"
518- weight = { 500 }
519- integerSize = "sm"
520- fractionSize = "xs"
521- />
522518 </ Container >
523519 ) }
524520 </ Container >
0 commit comments