Skip to content

Commit a1cd42f

Browse files
gregfromstlclaude
andcommitted
feat: disable testnets in payment link form
- Add disableTestnets prop to SingleNetworkSelector component - Apply disableTestnets to payment link form network selector 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent a83e6eb commit a1cd42f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
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/pay/components/client/PaymentLinkForm.client.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ export function PaymentLinkForm({ client }: { client: ThirdwebClient }) {
205205
chainId={chainId}
206206
onChange={setChainId}
207207
client={client}
208+
disableTestnets
208209
className="w-full"
209210
/>
210211
</div>

0 commit comments

Comments
 (0)