From 7542ee448d9829c44da67b9b8f86748280034e16 Mon Sep 17 00:00:00 2001 From: Naman Dhingra <1608naman@gmail.com> Date: Thu, 6 Jun 2024 08:51:46 +0530 Subject: [PATCH 1/4] tailwind config support in the frontend --- frontend/src/App.tsx | 38 +++++++-------- frontend/src/components/SettingsDialog.tsx | 55 ++++++++++++++++++---- frontend/src/types.ts | 1 + 3 files changed, 67 insertions(+), 27 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 5156a0f0b..6e37df864 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -71,6 +71,7 @@ function App() { codeGenerationModel: CodeGenerationModel.GPT_4O_2024_05_13, // Only relevant for hosted version isTermOfServiceAccepted: false, + tailwindConfig: null, }, "setting" ); @@ -403,7 +404,7 @@ function App() { /> )}
-
+

Screenshot to Code

@@ -426,15 +427,15 @@ function App() { /> {showReactWarning && ( -
+
Sorry - React is not currently working with GPT-4 Turbo. Please use GPT-4 Vision or Claude Sonnet. We are working on a fix.
)} {showGpt4OMessage && ( -
-

+

+

Now supporting GPT-4o. Higher quality and 2x faster. Give it a try!

@@ -446,7 +447,7 @@ function App() { {IS_RUNNING_ON_CLOUD && !settings.openAiApiKey && } {IS_OPENAI_DOWN && ( -
+
OpenAI API is currently down. Try back in 30 minutes or later. We apologize for the inconvenience.
@@ -461,8 +462,7 @@ function App() { {/* Speed disclaimer for video mode */} {inputMode === "video" && (
Code generation from videos can take 3-4 minutes. We do multiple passes to get the best result. Please be patient. @@ -495,8 +495,8 @@ function App() { onChange={(e) => setUpdateInstruction(e.target.value)} value={updateInstruction} /> -
-
+
+
Include screenshot of current version?
-
+
-
+
)} {/* Reference image display */} -
+
{referenceImages.length > 0 && (
)}
-
+
{inputMode === "video" ? "Original Video" : "Original Screenshot"}
)} -
-

+
+

Console

{executionConsole.map((line, index) => (
{line}
@@ -600,7 +600,7 @@ function App() {
{appState === AppState.INITIAL && ( -
+
-
+
{appState === AppState.CODE_READY && ( <> @@ -627,7 +627,7 @@ function App() { diff --git a/frontend/src/components/SettingsDialog.tsx b/frontend/src/components/SettingsDialog.tsx index 97d8f3887..211191b5a 100644 --- a/frontend/src/components/SettingsDialog.tsx +++ b/frontend/src/components/SettingsDialog.tsx @@ -30,12 +30,30 @@ interface Props { function SettingsDialog({ settings, setSettings }: Props) { const handleThemeChange = (theme: EditorTheme) => { - setSettings((s) => ({ + setSettings((s: Settings) => ({ ...s, editorTheme: theme, })); }; + const handleFileChange = (event: Event) => { + const target= event.target as HTMLInputElement; + const file: File = (target.files as FileList)[0]; + if (file) { + const reader = new FileReader(); + reader.onload = (e) => { + const content = e!.target!.result; + // Here you can set the file content to the settings + console.log(content); + setSettings((s: any) => ({ + ...s, + tailwindConfig: content, + })); + }; + reader.readAsText(file); + } + }; + return ( @@ -49,7 +67,7 @@ function SettingsDialog({ settings, setSettings }: Props) {