Skip to content

Commit bd5a9c5

Browse files
committed
Dashboard: Fix No Funds PayEmbed in TransactionButton
1 parent 857d4df commit bd5a9c5

File tree

2 files changed

+27
-37
lines changed

2 files changed

+27
-37
lines changed

apps/dashboard/src/@/components/tx-button/MismatchButton.tsx

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
} from "thirdweb";
1919
import { type Chain, type ChainMetadata, localhost } from "thirdweb/chains";
2020
import {
21-
PayEmbed,
21+
CheckoutWidget,
2222
useActiveAccount,
2323
useActiveWallet,
2424
useActiveWalletChain,
@@ -29,7 +29,6 @@ import {
2929
import { privateKeyToAccount, type Wallet } from "thirdweb/wallets";
3030
import { apiServerProxy } from "@/actions/proxies";
3131
import { Button } from "@/components/ui/button";
32-
import { DynamicHeight } from "@/components/ui/DynamicHeight";
3332
import {
3433
Dialog,
3534
DialogContent,
@@ -251,39 +250,34 @@ export const MismatchButton = forwardRef<
251250
>
252251
<DialogContent
253252
className={cn(
254-
"gap-0 p-0",
255-
dialog === "no-funds" && "md:!max-w-[480px]",
256-
dialog === "pay" && "md:!max-w-[360px] border-none bg-transparent",
253+
"gap-0 p-0 md:!max-w-[480px]",
254+
dialog === "pay" && "border-none bg-transparent",
257255
)}
258256
dialogCloseClassName="focus:ring-0"
259257
>
260-
<DynamicHeight>
261-
{dialog === "no-funds" && (
262-
<NoFundsDialogContent
263-
chain={txChain}
264-
client={props.client}
265-
isLoggedIn={props.isLoggedIn}
266-
onCloseModal={() => setDialog(undefined)}
267-
openPayModal={() => {
268-
setDialog("pay");
269-
}}
270-
/>
271-
)}
258+
{dialog === "no-funds" && (
259+
<NoFundsDialogContent
260+
chain={txChain}
261+
client={props.client}
262+
isLoggedIn={props.isLoggedIn}
263+
onCloseModal={() => setDialog(undefined)}
264+
openPayModal={() => {
265+
setDialog("pay");
266+
}}
267+
/>
268+
)}
272269

273-
{dialog === "pay" && (
274-
<PayEmbed
275-
className="!w-auto"
276-
client={props.client}
277-
payOptions={{
278-
prefillBuy: {
279-
amount: "0.01",
280-
chain: txChain,
281-
},
282-
}}
283-
theme={getSDKTheme(theme === "dark" ? "dark" : "light")}
284-
/>
285-
)}
286-
</DynamicHeight>
270+
{dialog === "pay" && account && (
271+
<CheckoutWidget
272+
className="!w-full"
273+
client={props.client}
274+
chain={txChain}
275+
amount="0.01"
276+
name="Buy Funds"
277+
seller={account.address as `0x${string}`}
278+
theme={getSDKTheme(theme === "dark" ? "dark" : "light")}
279+
/>
280+
)}
287281
</DialogContent>
288282
</Dialog>
289283
</>
@@ -362,11 +356,7 @@ function NoFundsDialogContent(props: {
362356
(x) => x.enabled && x.service === "pay",
363357
) ? (
364358
// pay case
365-
<Button
366-
className="w-full"
367-
onClick={props.openPayModal}
368-
variant="primary"
369-
>
359+
<Button className="w-full" onClick={props.openPayModal}>
370360
Buy Funds
371361
</Button>
372362
) : // no funds options available

apps/dashboard/src/@/components/ui/DynamicHeight.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function DynamicHeight(props: {
1717
boxSizing: "border-box",
1818
height: height ? `${height}px` : "auto",
1919
overflow: "hidden",
20-
transition: props.transition || "height 250ms ease",
20+
transition: props.transition || "height 220ms ease",
2121
}}
2222
>
2323
<div

0 commit comments

Comments
 (0)