Skip to content

Commit 8b1048e

Browse files
committed
[TOOL-4898] Dashboard: Replace PayEmbed with BuyWidget in asset page, add tracking
1 parent 9d6739e commit 8b1048e

File tree

2 files changed

+28
-23
lines changed

2 files changed

+28
-23
lines changed

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/PayEmbedSection.tsx

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22

33
import { useTheme } from "next-themes";
44
import type { Chain, ThirdwebClient } from "thirdweb";
5-
import { PayEmbed } from "thirdweb/react";
6-
import { getSDKTheme } from "../../../../../../../../../@/utils/sdk-component-theme";
5+
import { BuyWidget } from "thirdweb/react";
6+
import {
7+
reportAssetBuyFailed,
8+
reportAssetBuySuccessful,
9+
} from "@/analytics/report";
10+
import { parseError } from "@/utils/errorParser";
11+
import { getSDKTheme } from "@/utils/sdk-component-theme";
712

813
export function BuyTokenEmbed(props: {
914
client: ThirdwebClient;
@@ -14,33 +19,33 @@ export function BuyTokenEmbed(props: {
1419
}) {
1520
const { theme } = useTheme();
1621
return (
17-
<PayEmbed
22+
<BuyWidget
23+
amount="1"
24+
chain={props.chain}
1825
className="!rounded-xl !w-full"
1926
client={props.client}
2027
connectOptions={{
2128
autoConnect: false,
2229
}}
23-
payOptions={{
24-
metadata: {
25-
name: `Buy ${props.tokenSymbol}`,
26-
},
27-
mode: "fund_wallet",
28-
prefillBuy: {
29-
allowEdits: {
30-
amount: true,
31-
chain: false,
32-
token: false,
33-
},
34-
amount: "1",
35-
chain: props.chain,
36-
token: {
37-
address: props.tokenAddress,
38-
name: props.tokenName,
39-
symbol: props.tokenSymbol,
40-
},
41-
},
30+
onError={(e) => {
31+
const errorMessage = parseError(e);
32+
reportAssetBuyFailed({
33+
assetType: "coin",
34+
chainId: props.chain.id,
35+
contractType: "DropERC20",
36+
error: errorMessage,
37+
});
38+
}}
39+
onSuccess={() => {
40+
reportAssetBuySuccessful({
41+
assetType: "coin",
42+
chainId: props.chain.id,
43+
contractType: "DropERC20",
44+
});
4245
}}
4346
theme={getSDKTheme(theme === "light" ? "light" : "dark")}
47+
title={`Buy ${props.tokenSymbol}`}
48+
tokenAddress={props.tokenAddress as `0x${string}`}
4449
/>
4550
);
4651
}

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/contract-analytics/contract-analytics.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function ContractAnalyticsOverview(props: {
3939
</div>
4040
<ThirdwebAreaChart
4141
cardContentClassName="p-0"
42-
chartClassName="aspect-[1.5] lg:aspect-[3]"
42+
chartClassName="aspect-[1.2] lg:aspect-[2.6]"
4343
className="border-none bg-background p-0"
4444
config={{
4545
events: {

0 commit comments

Comments
 (0)