Skip to content

Commit 9396d2b

Browse files
committed
fix
1 parent 48ad44f commit 9396d2b

File tree

6 files changed

+43
-106
lines changed

6 files changed

+43
-106
lines changed

components/App.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {getPartCodeUid} from './compiler';
3030
import { useDebounceFn } from 'ahooks';
3131
import { useRouter } from 'next/navigation';
3232
import copy from "copy-to-clipboard";
33+
import CodePreview from './components/CodePreview';
3334

3435

3536
const CodeTab = dynamic(
@@ -338,10 +339,13 @@ ${error.stack}
338339
{(appState === AppState.CODING ||
339340
appState === AppState.CODE_READY) && (
340341
<>
342+
{appState === AppState.CODING && (
343+
<CodePreview code={generatedCode}/>
344+
)}
341345
{/* Show code preview only when coding */}
342346
{appState === AppState.CODING && (
343347
<div className="flex flex-col">
344-
<div className="flex mt-4 w-full">
348+
<div className="flex w-full">
345349
<Button
346350
onClick={stop}
347351
className="w-full dark:text-white dark:bg-gray-700"

components/components/CodePreview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function CodePreview({ code }: Props) {
1717
<div
1818
ref={scrollRef}
1919
className="w-full px-2 bg-black text-green-400 whitespace-nowrap flex
20-
overflow-x-auto font-mono text-[10px] my-4"
20+
overflow-x-auto font-mono text-[10px] my-2"
2121
>
2222
{code}
2323
</div>

components/components/chatInput/index.tsx

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ import { SettingContext } from '../../contexts/SettingContext';
44
import { useRouter } from 'next/navigation';
55
import { LiaPencilRulerSolid } from "react-icons/lia";
66
import classNames from "classnames";
7+
import { GoArrowUpRight } from "react-icons/go";
8+
9+
const shortcutIdeas = [
10+
{
11+
id: 'Contactform',
12+
label: 'Contact form',
13+
value: 'A contact form with first name, last name, email, and message fields. Put the form in a card with a submit button.'
14+
},
15+
{
16+
id: 'Ecommercedashboard',
17+
label: 'Ecommerce dashboard',
18+
value: 'An ecommerce dashboard with a sidebar navigation and a table of recent orders.'
19+
}
20+
]
721

822
interface props {
923
openWhiteboard: () => void
@@ -43,12 +57,12 @@ export default function ChatInput({openWhiteboard}: props) {
4357
<div className='w-full flex items-center justify-center p-6 gap-6'>
4458
<div
4559
onClick={open}
46-
className='before:block before:absolute before:-inset-1 before:-skew-y-3 before:bg-pink-500 relative inline-block px-2'>
60+
className='cursor-pointer before:block before:absolute before:-inset-1 before:-skew-y-3 before:bg-pink-500 relative inline-block px-2'>
4761
<span className='relative text-white'>screenshot</span>
4862
</div>
4963
<div
5064
onClick={openWhiteboard}
51-
className='before:block before:absolute before:-inset-1 before:-skew-y-3 before:bg-green-500 relative inline-block px-2'>
65+
className='cursor-pointer before:block before:absolute before:-inset-1 before:-skew-y-3 before:bg-green-500 relative inline-block px-2'>
5266
<span className='relative text-white'>whiteboard</span>
5367
</div>
5468
<div
@@ -59,7 +73,7 @@ export default function ChatInput({openWhiteboard}: props) {
5973
setShowAnim(false);
6074
}, 800)
6175
}}
62-
className='before:block before:absolute before:-inset-1 before:-skew-y-3 before:bg-cyan-500 relative inline-block px-8'
76+
className='cursor-pointer before:block before:absolute before:-inset-1 before:-skew-y-3 before:bg-cyan-500 relative inline-block px-8'
6377
>
6478
<span className='relative text-white'>ideas</span>
6579
</div>
@@ -127,6 +141,24 @@ export default function ChatInput({openWhiteboard}: props) {
127141
</div>
128142
</div>
129143
</div>
144+
<div className='flex w-full mt-4 item-center justify-center gap-2'>
145+
{
146+
shortcutIdeas.map((shortcut) => {
147+
return (
148+
<button
149+
className='rounded-full border border-zinc-200 px-2 py-0.5 inline-flex gap-1 items-center whitespace-nowrap select-none hover:border-zinc-800 transition-colors'
150+
onClick={() => {
151+
setInitCreateText(shortcut.value);
152+
}}
153+
>
154+
{shortcut.label}
155+
<GoArrowUpRight/>
156+
</button>)
157+
})
158+
}
159+
160+
161+
</div>
130162
</div>
131163
</div>
132164
);

engine/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default function PreviewBox({ code, appState, sendMessageChange, history,
5050
const img = await takeScreenshot();
5151
setTimeout(() => {
5252
updateHistoryScreenshot(img);
53-
}, 2000)
53+
}, 1000)
5454
}
5555

5656
useEffect(() => {

pages/dashboard/index.tsx

Lines changed: 0 additions & 99 deletions
This file was deleted.

pages/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default function Dashboard() {
8080
</div>
8181
<main>
8282
<div className="w-full bg-white dark:bg-gray-800 border-t dark:border-t-gray-600 flex-col flex items-center justify-between p-3">
83-
<div className="relative mt-72 w-[520px] rounded-md shadow-sm">
83+
<div className="relative mt-96 w-[520px] rounded-md shadow-sm">
8484
<ChatInput
8585
openWhiteboard={() => {
8686
setOpenWhiteboard(true);

0 commit comments

Comments
 (0)