Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)
Python
move files around
Abi Raja79e36c952964
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsxindex fc5521a3..22ec5024 100644--- a/frontend/src/App.tsx+++ b/frontend/src/App.tsx@@ -30,9 +30,8 @@ import { USER_CLOSE_WEB_SOCKET_CODE } from "./constants";import CodeTab from "./components/CodeTab";import OutputSettingsSection from "./components/OutputSettingsSection";import { History } from "./history_types";-import HistoryDisplay, {- extractHistoryTree,-} from "./components/HistoryDisplay";+import HistoryDisplay from "./components/history/HistoryDisplay";+import { extractHistoryTree } from "./components/history/utils";import toast from "react-hot-toast";const IS_OPENAI_DOWN = false;diff --git a/frontend/src/components/HistoryDisplay.tsx b/frontend/src/components/history/HistoryDisplay.tsxsimilarity index 72%rename from frontend/src/components/HistoryDisplay.tsxrename to frontend/src/components/history/HistoryDisplay.tsxindex 69eb025a..b626df47 100644--- a/frontend/src/components/HistoryDisplay.tsx+++ b/frontend/src/components/history/HistoryDisplay.tsx@@ -1,5 +1,5 @@import { ScrollArea } from "@/components/ui/scroll-area";-import { History, HistoryItemType } from "../history_types";+import { History, HistoryItemType } from "../../history_types";import toast from "react-hot-toast";import classNames from "classnames";@@ -10,29 +10,6 @@ interface Props {shouldDisableReverts: boolean;}-export function extractHistoryTree(- history: History,- version: number-): string[] {- // History is in reverse chronological order-- // Get all history items up to the current version- const extractedHistory = history.slice(version);-- const obj: string[] = [];-- // Reverse the history so that it is in chronological order for the server- extractedHistory.reverse().forEach((item) => {- // Don't include the image for ai_create since the server gets it passed and will include it directly- if (item.type !== "ai_create") {- obj.push(item.inputs.prompt);- }- obj.push(item.code);- });-- return obj;-}-function displayHistoryItemType(itemType: HistoryItemType) {switch (itemType) {case "ai_create":diff --git a/frontend/src/components/history/utils.ts b/frontend/src/components/history/utils.tsnew file mode 100644index 00000000..8c7065ff--- /dev/null+++ b/frontend/src/components/history/utils.ts@@ -0,0 +1,24 @@+import { History } from "../../history_types";++export function extractHistoryTree(+ history: History,+ version: number+): string[] {+ // History is in reverse chronological order++ // Get all history items up to the current version+ const extractedHistory = history.slice(version);++ const obj: string[] = [];++ // Reverse the history so that it is in chronological order for the server+ extractedHistory.reverse().forEach((item) => {+ // Don't include the image for ai_create since the server gets it passed and will include it directly+ if (item.type !== "ai_create") {+ obj.push(item.inputs.prompt);+ }+ obj.push(item.code);+ });++ return obj;+}