-
Notifications
You must be signed in to change notification settings - Fork 675
Add API Reference section to portal app #7968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
05598d4
Add API Reference section to portal app
0xFirekeeper 424684e
fmt
0xFirekeeper 573d927
Refactor class names to use 'size-*' utility
0xFirekeeper ece023f
Replace custom API reference with Scalar component
0xFirekeeper af51f8d
fix format
MananTank f43676a
cleanup
MananTank 9a3c26e
fix sidebar height
MananTank 172c424
fix knip lint
MananTank 984072d
fix pnpm lock file
MananTank File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| "use client"; | ||
|
|
||
| import { ApiReferenceReact } from "@scalar/api-reference-react"; | ||
| import "@scalar/api-reference-react/style.css"; | ||
| import "./scalar.css"; | ||
| import { useTheme } from "next-themes"; | ||
| import { useEffect } from "react"; | ||
|
|
||
| export function ScalarApiReference() { | ||
| const { theme } = useTheme(); | ||
|
|
||
| // scaler is using light-mode and dark-mode classes for theming | ||
| useEffect(() => { | ||
| if (theme === "dark") { | ||
| document.body.classList.remove("light-mode"); | ||
| document.body.classList.add("dark-mode"); | ||
| } else { | ||
| document.body.classList.remove("dark-mode"); | ||
| document.body.classList.add("light-mode"); | ||
| } | ||
| }, [theme]); | ||
|
MananTank marked this conversation as resolved.
|
||
|
|
||
| return ( | ||
| <ApiReferenceReact | ||
| configuration={{ | ||
| url: "https://api.thirdweb.com/openapi.json", | ||
| theme: "deepSpace", | ||
| layout: "modern", | ||
| showSidebar: true, | ||
| hideModels: false, | ||
| hideDarkModeToggle: true, // Hide since portal controls theme | ||
| hideDownloadButton: false, | ||
| hideTestRequestButton: false, | ||
| }} | ||
| /> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { createMetadata } from "@/components/Document"; | ||
| import { ScalarApiReference } from "./ScalarClient"; | ||
|
|
||
| export const metadata = createMetadata({ | ||
| image: { | ||
| title: "API Reference", | ||
| icon: "thirdweb", | ||
| }, | ||
| title: "thirdweb API Reference", | ||
| description: "Complete REST API reference for all thirdweb services", | ||
| }); | ||
|
|
||
| export default function ApiReferencePage() { | ||
| return ( | ||
| <div className="container max-sm:px-0"> | ||
| <ScalarApiReference /> | ||
| </div> | ||
| ); | ||
| } | ||
|
MananTank marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| .scalar-app { | ||
| --scalar-background-1: hsl(var(--background)); | ||
| --scalar-background-2: hsl(var(--card)); | ||
| } | ||
|
|
||
| /* fixes sticky sidebar and header on mobile */ | ||
| .scalar-app .references-navigation-list, | ||
| .scalar-app .references-header { | ||
| position: sticky; | ||
| top: var(--sticky-top-height); | ||
| } | ||
|
|
||
| .scalar-app .references-navigation-list { | ||
| height: calc(100vh - var(--sticky-top-height)); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.