Skip to content

Commit 50dd127

Browse files
committed
Update prompts, command enter shortcut in create modal
1 parent 2cc543d commit 50dd127

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

packages/api/prompts/app-builder.txt

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
- The goal is to get a FUNCTIONAL MVP. All of the parts for this MVP should be included.
3939
- Your job is to be precise and effective, so avoid extraneous steps even if they offer convenience.
4040
- Do not talk or worry about testing. The user wants to _use_ the app: the core goal is for it to _work_.
41+
- 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
42+
- For styles: apply modern, minimalistic styles. Things shoud look modern, clean and slick.
4143

4244

4345
## Example response

packages/api/prompts/app-editor.txt

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
- The goal is to get a FUNCTIONAL MVP. All of the parts for this MVP should be included.
3737
- Your job is to be precise and effective, so avoid extraneous steps even if they offer convenience.
3838
- Do not talk or worry about testing. The user wants to _use_ the app: the core goal is for it to _work_.
39+
- 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
40+
- For styles: apply modern, minimalistic styles. Things shoud look modern, clean and slick.
3941

4042

4143
## Example response

packages/web/src/components/apps/create-modal.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useState } from 'react';
1+
import { useState, KeyboardEvent } from 'react';
22
import { cn } from '@/lib/utils';
33
import { Input } from '@srcbook/components/src/components/ui/input';
44
import { Button } from '@srcbook/components/src/components/ui/button';
@@ -55,6 +55,12 @@ export default function CreateAppModal({ onClose, onCreate }: PropsType) {
5555
}
5656
}
5757

58+
const handleKeyDown = (e: KeyboardEvent<HTMLTextAreaElement>) => {
59+
if ((e.metaKey || e.ctrlKey) && e.key === 'Enter') {
60+
onSubmit(e);
61+
}
62+
};
63+
5864
return (
5965
<Dialog
6066
open
@@ -122,6 +128,7 @@ export default function CreateAppModal({ onClose, onCreate }: PropsType) {
122128
name="app[prompt]"
123129
value={prompt}
124130
onChange={(e) => setPrompt(e.currentTarget.value)}
131+
onKeyDown={handleKeyDown}
125132
className="h-20"
126133
placeholder="A Spotify-like app, showcasing a user's favorite playlists and most listened to songs."
127134
></Textarea>

0 commit comments

Comments
 (0)