Skip to content

Commit 8b50779

Browse files
gregfromstlclaude
andauthored
[Dashboard] Feature: Disable testnets in Payment Link form (#7000)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 282d9f2 commit 8b50779

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

apps/dashboard/src/@/components/blocks/NetworkSelectors.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ export function SingleNetworkSelector(props: {
144144
side?: "left" | "right" | "top" | "bottom";
145145
disableChainId?: boolean;
146146
align?: "center" | "start" | "end";
147+
disableTestnets?: boolean;
147148
placeholder?: string;
148149
client: ThirdwebClient;
149150
}) {
@@ -154,8 +155,12 @@ export function SingleNetworkSelector(props: {
154155
return allChains;
155156
}
156157
const chainIdSet = new Set(props.chainIds);
157-
return allChains.filter((chain) => chainIdSet.has(chain.chainId));
158-
}, [allChains, props.chainIds]);
158+
return allChains.filter(
159+
(chain) =>
160+
chainIdSet.has(chain.chainId) &&
161+
(!props.disableTestnets || !chain.testnet),
162+
);
163+
}, [allChains, props.chainIds, props.disableTestnets]);
159164

160165
const options = useMemo(() => {
161166
return chainsToShow.map((chain) => {

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/connect/universal-bridge/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default async function Page(props: {
3737
return (
3838
<ResponsiveSearchParamsProvider value={props.searchParams}>
3939
<div>
40-
<div className="mb-4 flex justify-end">
40+
<div className="mb-4 flex justify-start">
4141
<PayAnalyticsFilter />
4242
</div>
4343
<ResponsiveSuspense

apps/dashboard/src/app/pay/components/client/PaymentLinkForm.client.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function PaymentLinkForm({ client }: { client: ThirdwebClient }) {
9393
amount,
9494
);
9595

96-
// Build checkout URL
96+
// Build payment URL
9797
const params = new URLSearchParams({
9898
chainId: inputs.chainId.toString(),
9999
recipientAddress: inputs.recipientAddress,
@@ -112,13 +112,13 @@ export function PaymentLinkForm({ client }: { client: ThirdwebClient }) {
112112
params.set("image", imageUri);
113113
}
114114

115-
const checkoutUrl = `${window.location.origin}/checkout?${params.toString()}`;
115+
const paymentUrl = `${window.location.origin}/pay?${params.toString()}`;
116116

117117
// Copy to clipboard
118-
await navigator.clipboard.writeText(checkoutUrl);
118+
await navigator.clipboard.writeText(paymentUrl);
119119

120120
// Show success toast
121-
toast.success("Checkout link copied to clipboard.");
121+
toast.success("Payment link copied to clipboard.");
122122
} catch (err) {
123123
setError(err instanceof Error ? err.message : "An error occurred");
124124
} finally {
@@ -169,7 +169,7 @@ export function PaymentLinkForm({ client }: { client: ThirdwebClient }) {
169169
params.set("image", imageUri);
170170
}
171171

172-
window.open(`/checkout?${params.toString()}`, "_blank");
172+
window.open(`/pay?${params.toString()}`, "_blank");
173173
} catch (err) {
174174
toast.error(err instanceof Error ? err.message : "An error occurred");
175175
}
@@ -204,6 +204,7 @@ export function PaymentLinkForm({ client }: { client: ThirdwebClient }) {
204204
<SingleNetworkSelector
205205
chainId={chainId}
206206
onChange={setChainId}
207+
disableTestnets
207208
client={client}
208209
className="w-full"
209210
/>
@@ -254,7 +255,7 @@ export function PaymentLinkForm({ client }: { client: ThirdwebClient }) {
254255
/>
255256
</div>
256257

257-
<div className="space-y-4">
258+
<div className="space-y-2">
258259
<Button
259260
type="button"
260261
variant="ghost"
@@ -280,7 +281,7 @@ export function PaymentLinkForm({ client }: { client: ThirdwebClient }) {
280281
)}
281282
>
282283
<div className={cn(showAdvanced ? "" : "overflow-hidden")}>
283-
<div className="space-y-6 pt-2">
284+
<div className="space-y-3">
284285
<div className="space-y-2">
285286
<Label htmlFor="title" className="font-medium text-sm">
286287
Title
@@ -289,7 +290,7 @@ export function PaymentLinkForm({ client }: { client: ThirdwebClient }) {
289290
id="title"
290291
value={title}
291292
onChange={(e) => setTitle(e.target.value)}
292-
placeholder="Checkout for..."
293+
placeholder="A title for your payment"
293294
className="w-full"
294295
/>
295296
</div>

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { getAuthToken } from "app/(app)/api/lib/getAuthToken";
2-
import { loginRedirect } from "app/(app)/login/loginRedirect";
32
import type { Metadata } from "next";
43
import { createThirdwebClient, defineChain, getContract } from "thirdweb";
54
import { getCurrencyMetadata } from "thirdweb/extensions/erc20";
@@ -35,11 +34,6 @@ export default async function RoutesPage({
3534
) {
3635
const authToken = await getAuthToken();
3736

38-
if (!authToken) {
39-
const searchParams = new URLSearchParams(params);
40-
return loginRedirect(`/pay?${searchParams.toString()}`);
41-
}
42-
4337
const client = getClientThirdwebClient({
4438
jwt: authToken,
4539
teamId: undefined,

0 commit comments

Comments
 (0)