Skip to content

Commit

Permalink
[NEB-71] Nebula: Update example prompts (#5957)
Browse files Browse the repository at this point in the history
<!-- start pr-codex -->

## PR-Codex overview
This PR introduces a new type `ExamplePrompt` and a list of example prompts in `examplePrompts.ts`. It replaces hardcoded example prompts in `EmptyStateChatPageContent.tsx` with a dynamic mapping from the newly created `examplePrompts`, enhancing maintainability and readability.

### Detailed summary
- Added type `ExamplePrompt` with `title` and `message` properties.
- Created `examplePrompts` array containing several example prompts.
- Refactored `EmptyStateChatPageContent.tsx` to dynamically render `ExamplePrompt` components using `examplePrompts`.
- Removed hardcoded example prompts from `EmptyStateChatPageContent.tsx`.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
  • Loading branch information
MananTank committed Jan 16, 2025
1 parent afd0ccf commit 15178b2
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"use client";

import { Button } from "@/components/ui/button";
import { ArrowUpRightIcon } from "lucide-react";
import { Button } from "../../../../@/components/ui/button";
import { examplePrompts } from "../data/examplePrompts";
import { NebulaIcon } from "../icons/NebulaIcon";
import { ChatBar } from "./ChatBar";

Expand Down Expand Up @@ -35,44 +36,15 @@ export function EmptyStateChatPageContent(props: {
/>
<div className="h-5" />
<div className="flex flex-wrap justify-center gap-2.5">
<ExamplePrompt
label="USDC contract address on ethereum"
onClick={() => {
props.sendMessage(
"What is the contract address of USDC on ethereum?",
);
}}
/>

<ExamplePrompt
label="last 5 blocks on polygon"
onClick={() => {
props.sendMessage("What are last 5 blocks on polygon?");
}}
/>

<ExamplePrompt
label="What is thirdweb SDK?"
onClick={() => {
props.sendMessage("What is thirdweb SDK?");
}}
/>
<ExamplePrompt
label="How to add connect wallet button"
onClick={() => {
props.sendMessage(
"How to add connect wallet button on React app?",
);
}}
/>
<ExamplePrompt
label="Show transaction details"
onClick={() => {
props.sendMessage(
"Show transaction details of 0xff9624116c352c8b090203fbbb563baf32d2b1944f9ac281ff2de6b7d948030e on ethereum",
);
}}
/>
{examplePrompts.map((prompt) => {
return (
<ExamplePrompt
key={prompt.title}
label={prompt.title}
onClick={() => props.sendMessage(prompt.message)}
/>
);
})}
</div>
</div>
</div>
Expand Down
32 changes: 32 additions & 0 deletions apps/dashboard/src/app/nebula-app/(app)/data/examplePrompts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
type ExamplePrompt = {
title: string;
message: string;
};

// Note:
// Keep the title as short as possible so 2 of them can fit in a single row on desktop viewport
// title is only used for displaying the example - the `message` is sent to server when user clicks on the example - it can be as long and descriptive as needed

export const examplePrompts: ExamplePrompt[] = [
{
title: "Deploy an ERC-20 Token",
message:
"Deploy an ERC-20 Token with name 'Hello World', description 'Hello world token deployed by Nebula', and symbol 'HELLO'",
},
{
title: "USDC contract address on Ethereum",
message: "What is the USDC contract address on Ethereum?",
},
{
title: "Analyze WETH smart contract",
message: "Analyze 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 on ethereum",
},
{
title: "Transfer 0.001 ETH to thirdweb.eth",
message: "Transfer 0.001 ETH to thirdweb.eth",
},
{
title: "Using session keys in Unity",
message: "How to use session key in Unity?",
},
];

0 comments on commit 15178b2

Please sign in to comment.