Open cpirich opened 1 year ago
Hello human! 👋
This PR was created by Otto to address the issue Create src/pages/create/description.tsx
Please review the PR carefully. Auto-generated code can and will contain subtle bugs and mistakes.
If you identify code that needs to be changed, please reject the PR with a specific reason. Be as detailed as possible in your comments. Otto will take these comments, make changes to the code and push up changes. Please note that this process will take a few minutes.
Once the code looks good, approve the PR and merge the code.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
otto-playground | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Sep 6, 2023 10:11pm |
Summary:
Create a Next.js page for src/pages/create/description.tsx. Here are the instructions:
Issue: Create the
description.tsx
page for the Next.js project creation flowBackground
We are building a Next.js web application for Otto, an AI-powered development platform. As part of the project creation flow, we need a
description.tsx
page where users can provide a detailed overview of their project. This page will be a part of the project creation wizard, which includes other pages for defining the project name, setup, and Slack integration.Task
Create a new Next.js page called
description.tsx
in thesrc/pages/create
directory. This page should be a functional component written in TypeScript using ES6 syntax, like arrow functions. Use Tailwind CSS for styling and next-auth/react for authentication.Detailed Instructions
Imports: Start by importing the necessary modules and components:
Props Interface: Define a
Props
interface for theDescription
component. For this page, we don't need any specific props.Authentication: Use the
useSession
hook fromnext-auth/react
to get the user's session. If the user is not authenticated, redirect them to the login page.State Management: Use the
useState
hook to manage the state of the project description. Initialize the state with an empty string.Handle Submit: Create a function called
handleSubmit
that will be called when the user submits the form. Inside this function, perform the following actions:Component Structure: The
Description
component should have the following structure:Layout
component wrapping the entire page content.h1
element for the page title.form
element with anonSubmit
event handler that calls thehandleSubmit
function.label
element for the project description input field.textarea
element for the project description input field. Bind its value to the state and update the state when the value changes.button
element for submitting the form.Styling: Use Tailwind CSS classes to style the page elements. Do not use custom CSS classes or import any CSS files directly.
Error Handling: Handle any errors that may occur during the API call and display an appropriate error message to the user.
TypeScript: Ensure that all TypeScript interfaces and types are used correctly throughout the component, including the Props interface, useState, and any other necessary types.
Example Code
Acceptance Criteria
description.tsx
page is created in thesrc/pages/create
directory.