From 2b3b3f4d4429c7e4bdf48dbb098391c9a484cb9d Mon Sep 17 00:00:00 2001 From: samya123456 Date: Mon, 20 Nov 2023 18:31:00 +0530 Subject: [PATCH 01/13] adding some git ignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 39aee32..1ea457d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ # Run logs backend/run_logs/* - +backend/backend/* +frontend/.env.local .env \ No newline at end of file From d31c52f0294667bd213b675c52ef5df6d751c771 Mon Sep 17 00:00:00 2001 From: Sangmin Park Date: Tue, 21 Nov 2023 10:46:41 +0900 Subject: [PATCH 02/13] fix(docs): fix links in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a41f924..9f93442 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ See the [Examples](#examples) section below for more demos. ## 🚀 Try It Out! -🆕 [Try it here](https://picoapps.xyz/free-tools/screenshot-to-code) (bring your own OpenAI key - **your key must have access to GPT-4 Vision. See [FAQ](#faqs) section below for details**). Or see [Getting Started](#getting-started) below for local install instructions. +🆕 [Try it here](https://picoapps.xyz/free-tools/screenshot-to-code) (bring your own OpenAI key - **your key must have access to GPT-4 Vision. See [FAQ](#%EF%B8%8F-faqs) section below for details**). Or see [Getting Started](#-getting-started) below for local install instructions. ## 🌟 Recent Updates From 7aef7164e0cb51a6adb955e182eaa15883931d91 Mon Sep 17 00:00:00 2001 From: Sangmin Park Date: Tue, 21 Nov 2023 10:51:53 +0900 Subject: [PATCH 03/13] fix(docs): fix links in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f93442..97bc183 100644 --- a/README.md +++ b/README.md @@ -81,4 +81,4 @@ https://github.com/abi/screenshot-to-code/assets/23818/3fec0f77-44e8-4fb3-a769-a ## 🌍 Hosted Version -🆕 [Try it here](https://picoapps.xyz/free-tools/screenshot-to-code) (bring your own OpenAI key - **your key must have access to GPT-4 Vision. See [FAQ](#faqs) section for details**). Or see [Getting Started](#getting-started) for local install instructions. +🆕 [Try it here](https://picoapps.xyz/free-tools/screenshot-to-code) (bring your own OpenAI key - **your key must have access to GPT-4 Vision. See [FAQ](#%EF%B8%8F-faqs) section for details**). Or see [Getting Started](#-getting-started) for local install instructions. From 2f1745a0b51ca53403000f6a2fb339c27318556a Mon Sep 17 00:00:00 2001 From: clean99 Date: Tue, 21 Nov 2023 15:54:01 +0800 Subject: [PATCH 04/13] feat: refactor app status type --- frontend/src/App.tsx | 26 +++++++++++++------------- frontend/src/types.ts | 6 ++++++ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index c2ec3fe..bb71064 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -17,7 +17,7 @@ import { Textarea } from "@/components/ui/textarea"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/ui/tabs"; import CodeMirror from "./components/CodeMirror"; import SettingsDialog from "./components/SettingsDialog"; -import { Settings } from "./types"; +import { AppStatus, Settings } from "./types"; import { IS_RUNNING_ON_CLOUD } from "./config"; import { PicoBadge } from "./components/PicoBadge"; import { OnboardingNote } from "./components/OnboardingNote"; @@ -26,8 +26,8 @@ import { UrlInputSection } from "./components/UrlInputSection"; import TermsOfServiceDialog from "./components/TermsOfServiceDialog"; function App() { - const [appState, setAppState] = useState<"INITIAL" | "CODING" | "CODE_READY">( - "INITIAL" + const [appState, setAppState] = useState( + AppStatus.INITIAL ); const [generatedCode, setGeneratedCode] = useState(""); const [referenceImages, setReferenceImages] = useState([]); @@ -62,7 +62,7 @@ function App() { }; const reset = () => { - setAppState("INITIAL"); + setAppState(AppStatus.INITIAL); setGeneratedCode(""); setReferenceImages([]); setExecutionConsole([]); @@ -71,7 +71,7 @@ function App() { function doGenerateCode(params: CodeGenerationParams) { setExecutionConsole([]); - setAppState("CODING"); + setAppState(AppStatus.CODING); // Merge settings with params const updatedParams = { ...params, ...settings }; @@ -81,7 +81,7 @@ function App() { (token) => setGeneratedCode((prev) => prev + token), (code) => setGeneratedCode(code), (line) => setExecutionConsole((prev) => [...prev, line]), - () => setAppState("CODE_READY") + () => setAppState(AppStatus.CODE_READY) ); } @@ -122,7 +122,7 @@ function App() {

Screenshot to Code

- {appState === "INITIAL" && ( + {appState === AppStatus.INITIAL && (

Drag & drop a screenshot to get started.

@@ -130,10 +130,10 @@ function App() { {IS_RUNNING_ON_CLOUD && !settings.openAiApiKey && } - {(appState === "CODING" || appState === "CODE_READY") && ( + {(appState === AppStatus.CODING || appState === AppStatus.CODE_READY) && ( <> {/* Show code preview only when coding */} - {appState === "CODING" && ( + {appState === AppStatus.CODING && (
@@ -143,7 +143,7 @@ function App() {
)} - {appState === "CODE_READY" && ( + {appState === AppStatus.CODE_READY && (