Skip to content
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

Update prompts, command enter shortcut in create modal #407

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/api/prompts/app-builder.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
- The goal is to get a FUNCTIONAL MVP. All of the parts for this MVP should be included.
- Your job is to be precise and effective, so avoid extraneous steps even if they offer convenience.
- Do not talk or worry about testing. The user wants to _use_ the app: the core goal is for it to _work_.
- For react: modularize components into their own files, even small ones. We don't want one large App.tsx with everything inline, but different components in their respective src/components/{Component}.tsx files
- For styles: apply modern, minimalistic styles. Things shoud look modern, clean and slick.


## Example response
Expand Down
2 changes: 2 additions & 0 deletions packages/api/prompts/app-editor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
- The goal is to get a FUNCTIONAL MVP. All of the parts for this MVP should be included.
- Your job is to be precise and effective, so avoid extraneous steps even if they offer convenience.
- Do not talk or worry about testing. The user wants to _use_ the app: the core goal is for it to _work_.
- For react: modularize components into their own files, even small ones. We don't want one large App.tsx with everything inline, but different components in their respective src/components/{Component}.tsx files
- For styles: apply modern, minimalistic styles. Things shoud look modern, clean and slick.


## Example response
Expand Down
9 changes: 8 additions & 1 deletion packages/web/src/components/apps/create-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from 'react';
import { useState, KeyboardEvent } from 'react';
import { cn } from '@/lib/utils';
import { Input } from '@srcbook/components/src/components/ui/input';
import { Button } from '@srcbook/components/src/components/ui/button';
Expand Down Expand Up @@ -55,6 +55,12 @@ export default function CreateAppModal({ onClose, onCreate }: PropsType) {
}
}

const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {
if ((e.metaKey || e.ctrlKey) && e.key === 'Enter') {
onSubmit(e);
}
};

return (
<Dialog
open
Expand Down Expand Up @@ -122,6 +128,7 @@ export default function CreateAppModal({ onClose, onCreate }: PropsType) {
name="app[prompt]"
value={prompt}
onChange={(e) => setPrompt(e.currentTarget.value)}
onKeyDown={handleKeyDown}
className="h-20"
placeholder="A Spotify-like app, showcasing a user's favorite playlists and most listened to songs."
></Textarea>
Expand Down