Skip to content

Commit e60ec1f

Browse files
[SDK] fix: Hide dollar values for wallet balances
1 parent e9ab8cb commit e60ec1f

File tree

4 files changed

+36
-15
lines changed

4 files changed

+36
-15
lines changed

.changeset/gentle-boats-grin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Dont display dollar and token values for wallet balances

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.tsx

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { Container } from "../../../components/basic.js";
2323
import { Button } from "../../../components/buttons.js";
2424
import { Text } from "../../../components/text.js";
2525
import { Blobbie } from "../../Blobbie.js";
26+
import { formatTokenBalance } from "../formatTokenBalance.js";
2627
import { FiatValue } from "./swap/FiatValue.js";
2728
import type { TokenBalance } from "./swap/PaymentSelectionScreen.js";
2829

@@ -116,13 +117,26 @@ function TokenBalanceRow(props: {
116117
</Container>
117118
</Container>
118119
<Container flex="row" center="y" gap="3xs" color="secondaryText">
119-
<FiatValue
120-
tokenAmount={tokenBalance.balance.displayValue}
121-
token={tokenBalance.token}
122-
chain={tokenBalance.chain}
123-
client={client}
124-
size="xs"
125-
/>
120+
<Container
121+
flex="column"
122+
color="secondaryText"
123+
gap="3xs"
124+
style={{
125+
justifyContent: "right",
126+
alignItems: "flex-end",
127+
}}
128+
>
129+
<Text size="xs" color="primaryText">
130+
{formatTokenBalance(tokenBalance.balance, true, 2)}
131+
</Text>
132+
<FiatValue
133+
tokenAmount={tokenBalance.balance.displayValue}
134+
token={tokenBalance.token}
135+
chain={tokenBalance.chain}
136+
client={client}
137+
size="xs"
138+
/>
139+
</Container>
126140
<ChevronRightIcon width={iconSize.md} height={iconSize.md} />
127141
</Container>
128142
</StyledButton>

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/BuyTokenInput.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,13 @@ export function BuyTokenInput(props: {
122122
</Container>
123123
</div>
124124

125-
<Container flex="row" center="both">
125+
<Container
126+
flex="row"
127+
center="both"
128+
style={{
129+
height: fontSize.xl,
130+
}}
131+
>
126132
<FiatValue
127133
tokenAmount={props.value}
128134
token={props.token}

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ export function FiatValue(
4141
return <Skeleton width={"50px"} height={fontSize.lg} />;
4242
}
4343

44-
return (
45-
<Text {...props}>
46-
{cryptoToFiatQuery.data?.result
47-
? `$${formatNumber(cryptoToFiatQuery.data.result, 2)}`
48-
: "-"}
49-
</Text>
50-
);
44+
return cryptoToFiatQuery.data?.result ? (
45+
<Text {...props}>${formatNumber(cryptoToFiatQuery.data.result, 2)}</Text>
46+
) : null;
5147
}

0 commit comments

Comments
 (0)