Skip to content

Commit e600e26

Browse files
update useSendTransaction to use new widget
1 parent 2998cfe commit e600e26

File tree

12 files changed

+81
-30
lines changed

12 files changed

+81
-30
lines changed

apps/playground-web/src/app/connect/pay/components/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export type PayEmbedPlaygroundOptions = {
1212
mode?: "fund_wallet" | "direct_payment" | "transaction";
1313
title: string | undefined;
1414
image: string | undefined;
15+
description: string | undefined;
1516

1617
// fund_wallet mode options
1718
buyTokenAddress: string | undefined;

apps/playground-web/src/app/connect/pay/embed/LeftSection.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,26 @@ export function LeftSection(props: {
496496
/>
497497
</div>
498498
</div>
499+
500+
{/* Modal description */}
501+
<div className="flex flex-col gap-2">
502+
<Label htmlFor="modal-description">Image</Label>
503+
<Input
504+
id="modal-description"
505+
placeholder="Your own description here"
506+
className="bg-card"
507+
value={options.payOptions.description}
508+
onChange={(e) =>
509+
setOptions((v) => ({
510+
...v,
511+
payOptions: {
512+
...payOptions,
513+
description: e.target.value,
514+
},
515+
}))
516+
}
517+
/>
518+
</div>
499519
</div>
500520
</CollapsibleSection>
501521

apps/playground-web/src/app/connect/pay/embed/RightSection.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,19 @@ export function RightSection(props: {
7070
(props.options.payOptions.mode === "transaction"
7171
? "Transaction"
7272
: props.options.payOptions.mode === "direct_payment"
73-
? "Purchase"
73+
? "Product Name"
7474
: "Buy Crypto"),
75+
description:
76+
props.options.payOptions.description || "Your own description here",
7577
image:
7678
props.options.payOptions.image ||
77-
`https://placehold.co/600x400/${
78-
props.options.theme.type === "dark"
79-
? "1d1d23/7c7a85"
80-
: "f2eff3/6f6d78"
81-
}?text=Your%20Product%20Here&font=roboto`,
79+
props.options.payOptions.mode === "direct_payment"
80+
? `https://placehold.co/600x400/${
81+
props.options.theme.type === "dark"
82+
? "1d1d23/7c7a85"
83+
: "f2eff3/6f6d78"
84+
}?text=Your%20Product%20Here&font=roboto`
85+
: undefined,
8286
},
8387

8488
// Mode-specific options

packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ export function DirectPayment({
8181
);
8282

8383
return (
84-
<WithHeader uiOptions={uiOptions} defaultTitle="Direct Payment">
84+
<WithHeader
85+
uiOptions={uiOptions}
86+
defaultTitle="Direct Payment"
87+
client={client}
88+
>
8589
{/* Price section */}
8690
<Container
8791
flex="row"

packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export function FundWallet({
121121
<WithHeader
122122
uiOptions={uiOptions}
123123
defaultTitle={`Buy ${uiOptions.destinationToken.symbol}`}
124+
client={client}
124125
>
125126
<Container flex="column">
126127
{/* Token Info */}

packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export function StepRunner({
230230
}
231231

232232
// Fallback to step number
233-
return `Step ${index + 1}: Process transaction`;
233+
return "Process transaction";
234234
};
235235

236236
const getOnrampDescription = (

packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ export function TransactionPayment({
132132

133133
if (isLoading) {
134134
return (
135-
<WithHeader uiOptions={uiOptions} defaultTitle="Transaction">
135+
<WithHeader
136+
uiOptions={uiOptions}
137+
defaultTitle="Transaction"
138+
client={client}
139+
>
136140
{/* Loading Header */}
137141
<SkeletonHeader />
138142

@@ -178,7 +182,11 @@ export function TransactionPayment({
178182
}
179183

180184
return (
181-
<WithHeader uiOptions={uiOptions} defaultTitle="Transaction">
185+
<WithHeader
186+
uiOptions={uiOptions}
187+
defaultTitle="Transaction"
188+
client={client}
189+
>
182190
{/* Cost and Function Name section */}
183191
<Container
184192
flex="row"

packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { ThirdwebClient } from "../../../../../client/client.js";
2+
import { resolveScheme } from "../../../../../utils/ipfs.js";
13
import { useCustomTheme } from "../../../../core/design-system/CustomThemeProvider.js";
24
import { radius } from "../../../../core/design-system/index.js";
35
import { Spacer } from "../../components/Spacer.js";
@@ -9,7 +11,13 @@ export function WithHeader({
911
children,
1012
uiOptions,
1113
defaultTitle,
12-
}: { children: React.ReactNode; uiOptions: UIOptions; defaultTitle: string }) {
14+
client,
15+
}: {
16+
children: React.ReactNode;
17+
uiOptions: UIOptions;
18+
defaultTitle: string;
19+
client: ThirdwebClient;
20+
}) {
1321
const theme = useCustomTheme();
1422
return (
1523
<Container flex="column">
@@ -21,8 +29,11 @@ export function WithHeader({
2129
borderRadius: `${radius.md} ${radius.md} 0 0`,
2230
overflow: "hidden",
2331
aspectRatio: "16/9",
24-
backgroundColor: theme.colors.secondaryIconColor,
25-
backgroundImage: `url(${uiOptions.metadata.image})`,
32+
backgroundColor: theme.colors.tertiaryBg,
33+
backgroundImage: `url(${resolveScheme({
34+
client,
35+
uri: uiOptions.metadata.image,
36+
})})`,
2637
backgroundSize: "cover",
2738
backgroundPosition: "center",
2839
}}

packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ const TransactionOverViewCompact = (props: {
268268
>
269269
<Container flex="column" gap="3xs" center="y" style={{ flex: 1 }}>
270270
<Text size="sm" color="primaryText" style={{ fontWeight: 600 }}>
271-
{props.uiOptions.metadata?.title || "Onchain Transaction"}
271+
{props.uiOptions.metadata?.title || "Transaction"}
272272
</Text>
273273
{props.uiOptions.metadata?.description && (
274274
<Text size="xs" color="secondaryText">

packages/thirdweb/src/react/web/ui/Bridge/payment-success/PaymentReceipt.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function useTransactionInfo(
9696
return {
9797
type: "transactionHash" as const,
9898
id: tx.transactionHash,
99-
label: "Onchain Transaction",
99+
label: "Transaction",
100100
chain: destinationChain,
101101
originToken: status.originToken,
102102
originChain,

0 commit comments

Comments
 (0)