Skip to content

Commit d0a0330

Browse files
committed
update
1 parent 7973d64 commit d0a0330

File tree

3 files changed

+256
-222
lines changed

3 files changed

+256
-222
lines changed

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx

Lines changed: 66 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import styled from "@emotion/styled";
22
import { getCachedChain } from "../../../../../../../chains/utils.js";
33
import type { ThirdwebClient } from "../../../../../../../client/client.js";
4+
import { TokenProvider } from "../../../../../../../react/web/ui/prebuilt/Token/provider.js";
45
import { formatNumber } from "../../../../../../../utils/formatNumber.js";
56
import { useCustomTheme } from "../../../../../../core/design-system/CustomThemeProvider.js";
67
import { spacing } from "../../../../../../core/design-system/index.js";
@@ -37,73 +38,81 @@ export function BuyTxHistoryButton(props: {
3738
paddingBlock: spacing.sm,
3839
}}
3940
>
40-
<Container
41-
flex="row"
42-
center="y"
43-
gap="sm"
44-
style={{
45-
flex: 1,
46-
}}
41+
<TokenProvider
42+
address={props.txInfo.status.quote.toToken.tokenAddress}
43+
client={props.client}
44+
chain={getCachedChain(props.txInfo.status.quote.toToken.chainId)}
4745
>
48-
<PayTokenIcon
49-
client={props.client}
50-
chain={getCachedChain(props.txInfo.status.quote.toToken.chainId)}
51-
size="md"
52-
token={{
53-
address: props.txInfo.status.quote.toToken.tokenAddress,
54-
}}
55-
/>
56-
57-
<div
46+
<Container
47+
flex="row"
48+
center="y"
49+
gap="sm"
5850
style={{
5951
flex: 1,
60-
display: "flex",
61-
flexDirection: "column",
62-
justifyContent: "center",
6352
}}
6453
>
65-
{/* Row 1 */}
66-
<Container
67-
flex="row"
68-
gap="xs"
69-
center="y"
70-
style={{
71-
justifyContent: "space-between",
54+
<PayTokenIcon
55+
client={props.client}
56+
chain={getCachedChain(props.txInfo.status.quote.toToken.chainId)}
57+
size="md"
58+
token={{
59+
address: props.txInfo.status.quote.toToken.tokenAddress,
7260
}}
73-
>
74-
<Text size="sm" color="primaryText">
75-
Buy{" "}
76-
{formatNumber(
77-
Number(
78-
props.txInfo.type === "swap"
79-
? props.txInfo.status.quote.toAmount
80-
: props.txInfo.status.quote.estimatedToTokenAmount,
81-
),
82-
6,
83-
)}{" "}
84-
{props.txInfo.status.quote.toToken.symbol}
85-
</Text>
86-
</Container>
61+
/>
8762

88-
<Spacer y="xxs" />
89-
90-
{/* Row 2 */}
91-
<Container
92-
flex="row"
93-
center="y"
94-
gap="xxs"
63+
<div
9564
style={{
96-
justifyContent: "space-between",
65+
flex: 1,
66+
display: "flex",
67+
flexDirection: "column",
68+
justifyContent: "center",
9769
}}
9870
>
99-
<ChainName
100-
chain={getCachedChain(props.txInfo.status.quote.toToken.chainId)}
101-
size="xs"
102-
client={props.client}
103-
/>
104-
</Container>
105-
</div>
106-
</Container>
71+
{/* Row 1 */}
72+
<Container
73+
flex="row"
74+
gap="xs"
75+
center="y"
76+
style={{
77+
justifyContent: "space-between",
78+
}}
79+
>
80+
<Text size="sm" color="primaryText">
81+
Buy{" "}
82+
{formatNumber(
83+
Number(
84+
props.txInfo.type === "swap"
85+
? props.txInfo.status.quote.toAmount
86+
: props.txInfo.status.quote.estimatedToTokenAmount,
87+
),
88+
6,
89+
)}{" "}
90+
{props.txInfo.status.quote.toToken.symbol}
91+
</Text>
92+
</Container>
93+
94+
<Spacer y="xxs" />
95+
96+
{/* Row 2 */}
97+
<Container
98+
flex="row"
99+
center="y"
100+
gap="xxs"
101+
style={{
102+
justifyContent: "space-between",
103+
}}
104+
>
105+
<ChainName
106+
chain={getCachedChain(
107+
props.txInfo.status.quote.toToken.chainId,
108+
)}
109+
size="xs"
110+
client={props.client}
111+
/>
112+
</Container>
113+
</div>
114+
</Container>
115+
</TokenProvider>
107116

108117
{/* Status */}
109118
<Container flex="row" gap="xxs" center="y">

0 commit comments

Comments
 (0)