Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
Add test mode page and fix customization page broken links
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthirdweb committed Jul 17, 2024
1 parent 36a5aa3 commit 51c39a5
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 17 deletions.
32 changes: 16 additions & 16 deletions src/app/connect/pay/customization/connectbutton/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const metadata = createMetadata({

# Customize ConnectButton

Learn how to customize Pay within the `ConnectButton` interface. You can find a selection of popular customizations below. For the full list of props, you can [view the full reference](/references/typescript/v5/connectbuttonprops).
Learn how to customize Pay within the `ConnectButton` interface. You can find a selection of popular customizations below. For the full list of props, you can [view the full reference](/references/typescript/v5/ConnectButtonProps).

---

Expand Down Expand Up @@ -51,21 +51,21 @@ import { base } from "thirdweb/chains";
detailsModal={{
payOptions: {
prefillBuy: {
token: {
address: "0x866a087038f7C12cf33EF91aC5b1AcE6Ac1DA788",
name: "Base ETH",
symbol: "ETH",
icon: "...", // optional
},
chain: base,
allowEdits: {
amount: true, // allow editing buy amount
token: false, // disable selecting buy token
chain: false, // disable selecting buy chain
token: {
address: "0x866a087038f7C12cf33EF91aC5b1AcE6Ac1DA788",
name: "Base ETH",
symbol: "ETH",
icon: "...", // optional
},
chain: base,
allowEdits: {
amount: true, // allow editing buy amount
token: false, // disable selecting buy token
chain: false, // disable selecting buy chain
},
},
},
}}
}
/>;
```

Expand All @@ -79,7 +79,7 @@ If you'd like to prefill a purchase with a native token, you can set the chain w
prefillBuy: {
chain: base,
},
}
},
}}
/>
```
Expand All @@ -98,7 +98,7 @@ In some cases, you may only want to show users fiat or crypto payment options fo
detailsModal={{
payOptions: {
buyWithCrypto: false,
}
},
}}
/>
```
Expand All @@ -111,7 +111,7 @@ In some cases, you may only want to show users fiat or crypto payment options fo
detailsModal={{
payOptions: {
buyWithFiat: false,
}
},
}}
/>
```
Expand Down
78 changes: 78 additions & 0 deletions src/app/connect/pay/test-mode/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs";
import { createMetadata, Callout } from "@doc";

export const metadata = createMetadata({
image: {
title: "thirdweb Pay - Test Mode",
icon: "thirdweb",
},
title: "thirdweb Pay - Test Mode - thirdweb",
description: "thirdweb Pay - Test Mode",
});

# Enable Test Mode

Developers can turn on Buy With Fiat Test Mode to test fiat-to-crypto transactions through our onramp providers.

<Callout variant="info">

Crypto-to-crypto transactions will remain on mainnet during test mode as Pay
does not currently support testnets.

</Callout>

<Tabs defaultValue="connectbutton">

<TabsList>
<TabsTrigger value="connectbutton">ConnectButton</TabsTrigger>
<TabsTrigger value="payembed">PayEmbed</TabsTrigger>
<TabsTrigger value="sendtxn">sendTransaction</TabsTrigger>
</TabsList>

<TabsContent value='connectbutton'>

```tsx
<ConnectButton
client={client}
detailsModal={{
payOptions: {
buyWithFiat: {
testMode: true, // defaults to false
},
},
}}
/>
```

</TabsContent>

<TabsContent value="payembed">

```tsx
<PayEmbed
client={client}
payOptions={{
buyWithFiat: {
testMode: true, // defaults to false
},
}}
/>
```

</TabsContent>

<TabsContent value="sendtxn">

```tsx
const { mutate: sendTransaction } = useSendTransaction({
payModal: {
buyWithFiat: {
testMode: true, // defaults to false
},
},
});
```

</TabsContent>

</Tabs>
5 changes: 4 additions & 1 deletion src/app/connect/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ export const sidebar: SideBar = {
{
name: "Pay",
icon: <PayIcon />,
// isCollapsible: true,
links: [
{
name: "Overview",
Expand Down Expand Up @@ -452,6 +451,10 @@ export const sidebar: SideBar = {
},
],
},
{
name: "Enable Test Mode",
href: `${paySlug}/test-mode`,
},
{
name: "Build a Custom Experience",
href: `${paySlug}/build-a-custom-experience`,
Expand Down

0 comments on commit 51c39a5

Please sign in to comment.