Skip to content

Commit

Permalink
Update prompts, command enter shortcut in create modal (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
nichochar authored Oct 22, 2024
1 parent 2cc543d commit 215d87c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
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

0 comments on commit 215d87c

Please sign in to comment.