Skip to content

Commit f0eea90

Browse files
committed
[MNY-142] Dashboard: Do not render BuyWidget if token is not supported by Bridge
1 parent dbb2614 commit f0eea90

File tree

1 file changed

+39
-36
lines changed
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20

1 file changed

+39
-36
lines changed

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

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export async function ERC20PublicPage(props: {
2828
contractMetadata,
2929
activeClaimCondition,
3030
tokenDecimals,
31-
tokenInfo,
31+
tokenInfoFromUB,
3232
functionSelectors,
3333
tokenPriceData,
3434
] = await Promise.all([
@@ -51,8 +51,8 @@ export async function ERC20PublicPage(props: {
5151
}),
5252
]);
5353

54-
if (!contractMetadata.image && tokenInfo) {
55-
contractMetadata.image = tokenInfo.iconUri;
54+
if (!contractMetadata.image && tokenInfoFromUB) {
55+
contractMetadata.image = tokenInfoFromUB.iconUri;
5656
}
5757

5858
const [contractCreator, claimConditionCurrencyMeta] = await Promise.all([
@@ -70,24 +70,15 @@ export async function ERC20PublicPage(props: {
7070
const cookieStore = await cookies();
7171
const isDashboardUser = cookieStore.has(HAS_USED_DASHBOARD);
7272

73-
const buyEmbed = (
74-
<BuyEmbed
75-
chainMetadata={props.chainMetadata}
76-
claimConditionMeta={
77-
activeClaimCondition && claimConditionCurrencyMeta
78-
? {
79-
activeClaimCondition,
80-
claimConditionCurrency: claimConditionCurrencyMeta,
81-
}
82-
: undefined
83-
}
84-
clientContract={props.clientContract}
85-
tokenAddress={props.clientContract.address}
86-
tokenDecimals={tokenDecimals}
87-
tokenName={contractMetadata.name}
88-
tokenSymbol={contractMetadata.symbol}
89-
/>
90-
);
73+
const claimConditionMeta =
74+
activeClaimCondition && claimConditionCurrencyMeta
75+
? {
76+
activeClaimCondition,
77+
claimConditionCurrency: claimConditionCurrencyMeta,
78+
}
79+
: undefined;
80+
const isUBSupported = !!tokenInfoFromUB;
81+
const showBuyEmbed = isUBSupported || claimConditionMeta;
9182

9283
return (
9384
<div className="flex grow flex-col">
@@ -116,21 +107,33 @@ export async function ERC20PublicPage(props: {
116107

117108
<div className="container flex max-w-5xl grow flex-col pt-8 pb-10">
118109
<div className="flex grow flex-col gap-8">
119-
<div className="sm:flex sm:justify-center w-full sm:border sm:border-dashed sm:bg-accent/20 sm:py-12 rounded-lg overflow-hidden relative">
120-
<GridPattern
121-
width={30}
122-
height={30}
123-
x={-1}
124-
y={-1}
125-
strokeDasharray={"4 2"}
126-
className="text-border dark:text-border/70"
127-
style={{
128-
maskImage:
129-
"linear-gradient(to bottom right,white,transparent,transparent)",
130-
}}
131-
/>
132-
<div className="sm:w-[420px] z-10">{buyEmbed}</div>
133-
</div>
110+
{showBuyEmbed && (
111+
<div className="sm:flex sm:justify-center w-full sm:border sm:border-dashed sm:bg-accent/20 sm:py-12 rounded-lg overflow-hidden relative">
112+
<GridPattern
113+
width={30}
114+
height={30}
115+
x={-1}
116+
y={-1}
117+
strokeDasharray={"4 2"}
118+
className="text-border dark:text-border/70"
119+
style={{
120+
maskImage:
121+
"linear-gradient(to bottom right,white,transparent,transparent)",
122+
}}
123+
/>
124+
<div className="sm:w-[420px] z-10">
125+
<BuyEmbed
126+
chainMetadata={props.chainMetadata}
127+
claimConditionMeta={claimConditionMeta}
128+
clientContract={props.clientContract}
129+
tokenAddress={props.clientContract.address}
130+
tokenDecimals={tokenDecimals}
131+
tokenName={contractMetadata.name}
132+
tokenSymbol={contractMetadata.symbol}
133+
/>
134+
</div>
135+
</div>
136+
)}
134137

135138
{tokenPriceData ? (
136139
<>

0 commit comments

Comments
 (0)