From c4b99c125e514175a45b046dfe51f32d10e09529 Mon Sep 17 00:00:00 2001 From: Abi Raja Date: Tue, 14 Nov 2023 23:33:06 -0500 Subject: [PATCH] make layout better --- frontend/src/App.tsx | 156 +++++++++++++----------- frontend/src/components/ImageUpload.tsx | 2 +- frontend/src/index.css | 2 +- 3 files changed, 90 insertions(+), 70 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 19129af..c125ee2 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -21,6 +21,14 @@ function App() { setBlobUrl(url); }; + const reset = () => { + setAppState("INITIAL"); + setGeneratedCode(""); + setReferenceImages([]); + setExecutionConsole([]); + setBlobUrl(""); + }; + function startCodeGeneration(referenceImages: string[]) { setAppState("CODING"); setReferenceImages(referenceImages); @@ -42,79 +50,91 @@ function App() { } return ( -
-

Screenshot to Code

-

- drag & drop a screenshot below -

+
+
+
+

Screenshot to Code

+

+ Drag & drop a screenshot to get started. +

- {appState === "INITIAL" && ( - <> - - - )} - - {(appState === "CODING" || appState === "CODE_READY") && ( - <> -
-
- Reference -
-
-

Console

- {executionConsole.map((line, index) => ( -
- {line} -
- ))} -
-
- {/* Show code preview only when coding */} - {appState === "CODING" && ( + {(appState === "CODING" || appState === "CODE_READY") && ( <> -
- - {executionConsole.slice(-1)[0]} + {/* Show code preview only when coding */} + {appState === "CODING" && ( +
+
+ + {executionConsole.slice(-1)[0]} +
+ +
+ )} +
+
+ Reference +
+
+

+ Console +

+ {executionConsole.map((line, index) => ( +
+ {line} +
+ ))} +
- + + {appState === "CODE_READY" && ( +
+ + Download + + +
+ )} )} - {appState === "CODE_READY" && ( - - )} - - - )} +
+
+ +
+ {appState === "INITIAL" && ( + <> + + + )} + + {(appState === "CODING" || appState === "CODE_READY") && ( +
+ +
+ )} +
); } diff --git a/frontend/src/components/ImageUpload.tsx b/frontend/src/components/ImageUpload.tsx index e0dd0ec..16b5373 100644 --- a/frontend/src/components/ImageUpload.tsx +++ b/frontend/src/components/ImageUpload.tsx @@ -5,7 +5,7 @@ import { toast } from "react-hot-toast"; const baseStyle = { flex: 1, - width: "50%", + width: "80%", margin: "0 auto", minHeight: "400px", display: "flex", diff --git a/frontend/src/index.css b/frontend/src/index.css index 4f6e47a..f77300a 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -28,6 +28,6 @@ body { transform: translateX(0px); } 50% { - transform: translateX(300px); + transform: translateX(340px); } }