Skip to content

Commit e86db52

Browse files
authored
Merge branch 'main' into yash/add-api-snippets
2 parents 174dad4 + 2328985 commit e86db52

File tree

11 files changed

+1629
-102
lines changed

11 files changed

+1629
-102
lines changed

apps/dashboard/src/@/components/contracts/import-contract/modal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,13 @@ function ImportForm(props: {
231231
</Button>
232232
) : (
233233
<Button className="gap-2" type="submit">
234-
{addContractToProject.isPending ? (
234+
{form.formState.isSubmitting ? (
235235
<Spinner className="size-4" />
236236
) : (
237237
<ArrowDownToLineIcon className="size-4" />
238238
)}
239239

240-
{addContractToProject.isPending ? "Importing" : "Import"}
240+
{form.formState.isSubmitting ? "Importing" : "Import"}
241241
</Button>
242242
)}
243243
</div>

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
<>

apps/portal/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"@radix-ui/react-slot": "^1.2.3",
1111
"@radix-ui/react-tabs": "^1.1.12",
1212
"@radix-ui/react-tooltip": "1.2.7",
13+
"@scalar/api-reference-react": "^0.7.42",
1314
"@tanstack/react-query": "5.81.5",
1415
"@tryghost/content-api": "^1.11.28",
1516
"class-variance-authority": "^0.7.1",

apps/portal/src/app/Header.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ const links = [
5151
href: "/insight",
5252
name: "Insight",
5353
},
54+
{
55+
href: "/reference",
56+
name: "API Reference",
57+
},
5458
];
5559

5660
const toolLinks = [
@@ -281,7 +285,7 @@ export function Header() {
281285
}}
282286
>
283287
<NavLink href={link.href} name={link.name} />
284-
{pathname.startsWith(link.href) && (
288+
{pathname?.startsWith(link.href) && (
285289
<div className="bg-violet-700 h-[2px] inset-x-0 rounded-full absolute -bottom-1" />
286290
)}
287291
</li>
@@ -526,7 +530,7 @@ function NavLink(props: {
526530
<Link
527531
className={clsx(
528532
"font-medium text-base transition-colors hover:text-foreground xl:text-sm",
529-
pathname.startsWith(props.href)
533+
pathname?.startsWith(props.href)
530534
? "text-foreground"
531535
: "text-muted-foreground",
532536
props.icon ? "flex flex-row gap-3" : "",
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"use client";
2+
3+
import { ApiReferenceReact } from "@scalar/api-reference-react";
4+
import "@scalar/api-reference-react/style.css";
5+
import "./scalar.css";
6+
import { useTheme } from "next-themes";
7+
import { useEffect } from "react";
8+
9+
export function ScalarApiReference() {
10+
const { theme } = useTheme();
11+
12+
// scaler is using light-mode and dark-mode classes for theming
13+
useEffect(() => {
14+
if (theme === "dark") {
15+
document.body.classList.remove("light-mode");
16+
document.body.classList.add("dark-mode");
17+
} else {
18+
document.body.classList.remove("dark-mode");
19+
document.body.classList.add("light-mode");
20+
}
21+
}, [theme]);
22+
23+
return (
24+
<ApiReferenceReact
25+
configuration={{
26+
url: "https://api.thirdweb.com/openapi.json",
27+
theme: "deepSpace",
28+
layout: "modern",
29+
showSidebar: true,
30+
hideModels: false,
31+
hideDarkModeToggle: true, // Hide since portal controls theme
32+
hideDownloadButton: false,
33+
hideTestRequestButton: false,
34+
}}
35+
/>
36+
);
37+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { createMetadata } from "@/components/Document";
2+
import { ScalarApiReference } from "./ScalarClient";
3+
4+
export const metadata = createMetadata({
5+
image: {
6+
title: "API Reference",
7+
icon: "thirdweb",
8+
},
9+
title: "thirdweb API Reference",
10+
description: "Complete REST API reference for all thirdweb services",
11+
});
12+
13+
export default function ApiReferencePage() {
14+
return (
15+
<div className="container max-sm:px-0">
16+
<ScalarApiReference />
17+
</div>
18+
);
19+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.scalar-app {
2+
--scalar-background-1: hsl(var(--background));
3+
--scalar-background-2: hsl(var(--card));
4+
}
5+
6+
/* fixes sticky sidebar and header on mobile */
7+
.scalar-app .references-navigation-list,
8+
.scalar-app .references-header {
9+
position: sticky;
10+
top: var(--sticky-top-height);
11+
}
12+
13+
.scalar-app .references-navigation-list {
14+
height: calc(100vh - var(--sticky-top-height));
15+
}

packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/AllWalletsUI.tsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import { WalletEntryButton } from "../WalletEntryButton.js";
2828
function AllWalletsUI(props: {
2929
onBack: () => void;
3030
onSelect: (wallet: Wallet) => void;
31-
specifiedWallets: Wallet[];
3231
size: "compact" | "wide";
3332
client: ThirdwebClient;
3433
recommendedWallets: Wallet[] | undefined;
@@ -39,17 +38,11 @@ function AllWalletsUI(props: {
3938
const setSelectionData = useSetSelectionData();
4039

4140
const walletList = useMemo(() => {
42-
return walletInfos
43-
.filter((wallet) => {
44-
return (
45-
props.specifiedWallets.findIndex((x) => x.id === wallet.id) === -1
46-
);
47-
})
48-
.filter(
49-
(info) =>
50-
info.id !== "inApp" && info.id !== "embedded" && info.id !== "smart",
51-
);
52-
}, [props.specifiedWallets]);
41+
return walletInfos.filter(
42+
(info) =>
43+
info.id !== "inApp" && info.id !== "embedded" && info.id !== "smart",
44+
);
45+
}, []);
5346

5447
const fuseInstance = useMemo(() => {
5548
return new Fuse(walletList, {

packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ export const ConnectModalContent = (props: {
173173
onSelect={setScreen}
174174
recommendedWallets={props.recommendedWallets}
175175
size={props.size}
176-
specifiedWallets={props.wallets}
177176
/>
178177
</Suspense>
179178
);

packages/thirdweb/src/react/web/wallets/in-app/WalletAuth.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ export function WalletAuth(props: {
104104
}}
105105
recommendedWallets={undefined}
106106
size={props.size}
107-
specifiedWallets={[]}
108107
/>
109108
</Suspense>
110109
);

0 commit comments

Comments
 (0)