diff --git a/typescript/.changeset/dirty-candies-thank.md b/typescript/.changeset/dirty-candies-thank.md new file mode 100644 index 000000000..6f34042a7 --- /dev/null +++ b/typescript/.changeset/dirty-candies-thank.md @@ -0,0 +1,5 @@ +--- +"next-template": patch +--- + +Add next-template to workspace diff --git a/typescript/create-onchain-agent/templates/next/app/hooks/useAgent.ts b/typescript/create-onchain-agent/templates/next/app/hooks/useAgent.ts index 7d3c2a22f..2799a1c5c 100644 --- a/typescript/create-onchain-agent/templates/next/app/hooks/useAgent.ts +++ b/typescript/create-onchain-agent/templates/next/app/hooks/useAgent.ts @@ -41,7 +41,7 @@ async function messageAgent(userMessage: string): Promise { * #### See Also * - The API logic in `/api/agent.ts` * - * @returns {Object} An object containing: + * @returns {object} An object containing: * - `messages`: The conversation history. * - `sendMessage`: A function to send a new message. * - `isThinking`: Boolean indicating if the agent is processing a response. diff --git a/typescript/create-onchain-agent/templates/next/app/layout.tsx b/typescript/create-onchain-agent/templates/next/app/layout.tsx index fcadbe5f8..7513f0ce0 100644 --- a/typescript/create-onchain-agent/templates/next/app/layout.tsx +++ b/typescript/create-onchain-agent/templates/next/app/layout.tsx @@ -1,11 +1,21 @@ import type { Metadata } from "next"; import "./globals.css"; +/** + * Metadata for the page + */ export const metadata: Metadata = { title: "AgentKit Quickstart", description: "Generated by `create-onchain-agent`, a Next.js template for AgentKit", }; +/** + * Root layout for the page + * + * @param {object} props - The props for the root layout + * @param {React.ReactNode} props.children - The children for the root layout + * @returns {React.ReactNode} The root layout + */ export default function RootLayout({ children, }: Readonly<{ @@ -16,9 +26,9 @@ export default function RootLayout({ {/* Header (Fixed Height) */}
- Coinbase @@ -28,16 +38,14 @@ export default function RootLayout({
{/* Main Content (Dynamic, Grows but Doesn't Force Scroll) */} -
- {children} -
+
{children}
{/* Footer (Fixed Height) */} diff --git a/typescript/create-onchain-agent/templates/next/app/page.tsx b/typescript/create-onchain-agent/templates/next/app/page.tsx index 0fb0037d9..b1435a4f6 100644 --- a/typescript/create-onchain-agent/templates/next/app/page.tsx +++ b/typescript/create-onchain-agent/templates/next/app/page.tsx @@ -4,6 +4,11 @@ import { useState, useEffect, useRef } from "react"; import { useAgent } from "./hooks/useAgent"; import ReactMarkdown from "react-markdown"; +/** + * Home page for the AgentKit Quickstart + * + * @returns {React.ReactNode} The home page + */ export default function Home() { const [input, setInput] = useState(""); const { messages, sendMessage, isThinking } = useAgent(); @@ -45,24 +50,26 @@ export default function Home() { : "bg-gray-100 dark:bg-gray-700 self-start" }`} > - ( - - ), - }}>{msg.text} + ( + + ), + }} + > + {msg.text} + )) )} {/* Thinking Indicator */} - {isThinking && ( -
🤖 Thinking...
- )} + {isThinking &&
🤖 Thinking...
} {/* Invisible div to track the bottom */}
@@ -75,8 +82,8 @@ export default function Home() { className="flex-grow p-2 rounded border dark:bg-gray-700 dark:border-gray-600" placeholder={"Type a message..."} value={input} - onChange={(e) => setInput(e.target.value)} - onKeyDown={(e) => e.key === "Enter" && onSendMessage()} + onChange={e => setInput(e.target.value)} + onKeyDown={e => e.key === "Enter" && onSendMessage()} disabled={isThinking} />