Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)
Python
isolate history component by using projectStore directly
Abi Rajadeb237514676
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsxindex 8c397e92..ae58b896 100644--- a/frontend/src/App.tsx+++ b/frontend/src/App.tsx@@ -593,18 +593,6 @@ function App() {)}{<HistoryDisplay- history={appHistory}- currentVersion={currentVersion}- revertToVersion={(index) => {- if (- index < 0 ||- index >= appHistory.length ||- !appHistory[index]- )- return;- setCurrentVersion(index);- setGeneratedCode(appHistory[index].code);- }}shouldDisableReverts={appState === AppState.CODING}/>}diff --git a/frontend/src/components/history/HistoryDisplay.tsx b/frontend/src/components/history/HistoryDisplay.tsxindex ce00db4e..a3dcdb1a 100644--- a/frontend/src/components/history/HistoryDisplay.tsx+++ b/frontend/src/components/history/HistoryDisplay.tsx@@ -1,4 +1,3 @@-import { History } from "./history_types";import toast from "react-hot-toast";import classNames from "classnames";@@ -11,22 +10,27 @@ import {} from "../ui/collapsible";import { Button } from "../ui/button";import { CaretSortIcon } from "@radix-ui/react-icons";+import { useProjectStore } from "../../store/project-store";interface Props {- history: History;- currentVersion: number | null;- revertToVersion: (version: number) => void;shouldDisableReverts: boolean;}-export default function HistoryDisplay({- history,- currentVersion,- revertToVersion,- shouldDisableReverts,-}: Props) {+export default function HistoryDisplay({ shouldDisableReverts }: Props) {+ const {+ appHistory: history,+ currentVersion,+ setCurrentVersion,+ setGeneratedCode,+ } = useProjectStore();const renderedHistory = renderHistory(history, currentVersion);+ const revertToVersion = (index: number) => {+ if (index < 0 || index >= history.length || !history[index]) return;+ setCurrentVersion(index);+ setGeneratedCode(history[index].code);+ };+return renderedHistory.length === 0 ? null : (<div className="flex flex-col h-screen"><h1 className="font-bold mb-2">Versions</h1>