Skip to content

Commit 3b3e354

Browse files
committed
fix: pass client-side client from server
1 parent 4dd7401 commit 3b3e354

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

apps/dashboard/src/app/checkout/components/client/CheckoutLinkForm.client.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { Button } from "@/components/ui/button";
66
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
77
import { Input } from "@/components/ui/input";
88
import { Label } from "@/components/ui/label";
9-
import { useThirdwebClient } from "@/constants/thirdweb.client";
109
import { ChevronDownIcon, CreditCardIcon } from "lucide-react";
1110
import { useCallback, useMemo, useState } from "react";
1211
import { toast } from "sonner";
@@ -20,9 +19,9 @@ import { getCurrencyMetadata } from "thirdweb/extensions/erc20";
2019
import { resolveScheme, upload } from "thirdweb/storage";
2120
import { FileInput } from "../../../../components/shared/FileInput";
2221
import { resolveEns } from "../../../../lib/ens";
22+
import { cn } from "@/lib/utils";
2323

24-
export function CheckoutLinkForm() {
25-
const client = useThirdwebClient();
24+
export function CheckoutLinkForm({ client }: { client: ThirdwebClient }) {
2625
const [chainId, setChainId] = useState<number>();
2726
const [recipientAddress, setRecipientAddress] = useState("");
2827
const [tokenAddressWithChain, setTokenAddressWithChain] = useState("");
@@ -258,25 +257,27 @@ export function CheckoutLinkForm() {
258257
<Button
259258
type="button"
260259
variant="ghost"
261-
className="flex w-full items-center justify-between px-0 text-muted-foreground hover:bg-transparent"
260+
className={cn(
261+
"flex w-full items-center justify-between px-0 text-muted-foreground hover:bg-transparent",
262+
)}
262263
onClick={() => setShowAdvanced(!showAdvanced)}
263264
>
264265
<span>Advanced Options</span>
265266
<ChevronDownIcon
266-
className={`size-4 transition-transform duration-200 ease-in-out ${
267-
showAdvanced ? "rotate-180" : ""
268-
}`}
267+
className={`size-4 transition-transform duration-200 ease-in-out ${showAdvanced ? "rotate-180" : ""
268+
}`}
269269
/>
270270
</Button>
271271

272272
<div
273-
className={`grid transition-all duration-200 ease-in-out ${
273+
className={cn(
274+
"grid transition-all duration-200 ease-in-out",
274275
showAdvanced
275276
? "grid-rows-[1fr] opacity-100"
276-
: "grid-rows-[0fr] opacity-0"
277-
}`}
277+
: "grid-rows-[0fr] opacity-0",
278+
)}
278279
>
279-
<div className="overflow-hidden">
280+
<div className={cn(showAdvanced ? "" : "overflow-hidden")}>
280281
<div className="space-y-6 pt-2">
281282
<div className="space-y-2">
282283
<Label htmlFor="title" className="font-medium text-sm">
@@ -295,7 +296,7 @@ export function CheckoutLinkForm() {
295296
<Label htmlFor="image" className="font-medium text-sm">
296297
Image
297298
</Label>
298-
<div className="w-full px-1 pb-1">
299+
<div className="w-full">
299300
<FileInput
300301
accept={{ "image/*": [] }}
301302
setValue={handleImageUpload}

apps/dashboard/src/app/checkout/page.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ export default async function RoutesPage({
4040
return loginRedirect(`/checkout?${searchParams.toString()}`);
4141
}
4242

43-
return <CheckoutLinkForm />;
43+
const client = getClientThirdwebClient({
44+
jwt: authToken,
45+
teamId: undefined,
46+
});
47+
48+
return <CheckoutLinkForm client={client} />;
4449
}
4550

4651
// Validate query parameters

0 commit comments

Comments
 (0)