-
Notifications
You must be signed in to change notification settings - Fork 621
[TOOL-3764] Dashboard: Add Nebula FTUX #6616
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
+170
−46
Merged
Changes from all commits
Commits
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
22 changes: 22 additions & 0 deletions
22
...hboard/src/app/team/[team_slug]/[project_slug]/components/ProjectFTUX/ClientIDSection.tsx
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,22 @@ | ||
| import { CopyTextButton } from "@/components/ui/CopyTextButton"; | ||
|
|
||
| export function ClientIDSection(props: { | ||
| clientId: string; | ||
| }) { | ||
| return ( | ||
| <div> | ||
| <h3>Client ID</h3> | ||
| <p className="mb-2 text-muted-foreground text-sm"> | ||
| Identifies your application | ||
| </p> | ||
|
|
||
| <CopyTextButton | ||
| textToCopy={props.clientId} | ||
| className="!h-auto w-full max-w-[400px] justify-between truncate bg-background px-3 py-3 font-mono" | ||
| textToShow={props.clientId} | ||
| copyIconPosition="right" | ||
| tooltip="Copy Client ID" | ||
| /> | ||
| </div> | ||
| ); | ||
| } |
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
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
104 changes: 104 additions & 0 deletions
104
apps/dashboard/src/app/team/[team_slug]/[project_slug]/nebula/nebula-ftux.tsx
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,104 @@ | ||
| import { CodeServer } from "@/components/ui/code/code.server"; | ||
| import { SecretKeySection } from "../components/ProjectFTUX/SecretKeySection"; | ||
| import { WaitingForIntegrationCard } from "../components/WaitingForIntegrationCard/WaitingForIntegrationCard"; | ||
|
|
||
| export function NebulaFTUX(props: { | ||
| secretKeyMasked: string; | ||
| projectId: string; | ||
| }) { | ||
| return ( | ||
| <WaitingForIntegrationCard | ||
| title="Integrate Nebula" | ||
| codeTabs={[ | ||
| { | ||
| label: "JavaScript", | ||
| code: ( | ||
| <CodeServer code={jsCode} className="bg-background" lang="ts" /> | ||
| ), | ||
| }, | ||
| { | ||
| label: "Python", | ||
| code: ( | ||
| <CodeServer | ||
| code={pythonCode} | ||
| className="bg-background" | ||
| lang="python" | ||
| /> | ||
| ), | ||
| }, | ||
| { | ||
| label: "Curl", | ||
| code: ( | ||
| <CodeServer code={curlCode} className="bg-background" lang="bash" /> | ||
| ), | ||
| }, | ||
| ]} | ||
| ctas={[ | ||
| { | ||
| label: "Try on Playground", | ||
| href: "https://nebula.thirdweb.com/", | ||
| trackingLabel: "playground", | ||
| category: "nebula-ftux", | ||
| }, | ||
| { | ||
| label: "View Docs", | ||
| href: "https://portal.thirdweb.com/nebula", | ||
| trackingLabel: "docs", | ||
| category: "nebula-ftux", | ||
| }, | ||
| ]} | ||
| > | ||
| <SecretKeySection | ||
| secretKeyMasked={props.secretKeyMasked} | ||
| projectId={props.projectId} | ||
| /> | ||
| <div className="h-4" /> | ||
| </WaitingForIntegrationCard> | ||
| ); | ||
| } | ||
|
|
||
| const jsCode = `\ | ||
| // Example: Send message to Nebula | ||
| // Replace PROJECT_SECRET_KEY with your project's full secret key | ||
|
|
||
| const res = await fetch("https://nebula-api.thirdweb.com/chat", { | ||
| method: "POST", | ||
| headers: { | ||
| "x-secret-key": "PROJECT_SECRET_KEY", | ||
| }, | ||
| body: { | ||
| message: "Hello", | ||
| stream: false, | ||
| }, | ||
| }); | ||
|
|
||
| const data = await res.json(); | ||
| `; | ||
|
|
||
| const curlCode = `\ | ||
| # Example: Send message to Nebula | ||
| # Replace PROJECT_SECRET_KEY with your project's full secret key | ||
|
|
||
| curl -X POST https://nebula-api.thirdweb.com/chat \ | ||
| -H "x-secret-key:PROJECT_SECRET_KEY" \ | ||
| -d '{ | ||
| "message": "Hello", | ||
| "stream": false, | ||
| }' | ||
| `; | ||
|
|
||
| const pythonCode = `\ | ||
| # Example: Send message to Nebula | ||
| # Replace PROJECT_SECRET_KEY with your project's full secret key | ||
|
|
||
| import requests | ||
|
|
||
| response = requests.post("https://nebula-api.thirdweb.com/chat", headers={ | ||
| "x-secret-key": "PROJECT_SECRET_KEY" | ||
| }, json={ | ||
| "message": "Hello", | ||
| "stream": False, | ||
| }) | ||
|
|
||
| data = response.json() | ||
| `; | ||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
fetchrequest body is incorrectly formatted. When using the Fetch API, the body needs to be JSON-stringified and the appropriate content type header should be included:This correction should also be applied to the Python and cURL examples for consistency.
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.