Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

update name

Abi Raja2457a3f5bdb0
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index deb8a291..fe0b02e7 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -146,7 +146,7 @@ function App() {
setAppHistory([
{
type: "ai_create",
- parent: null,
+ parentIndex: null,
code,
inputs: { image_url: referenceImages[0] },
},
@@ -166,7 +166,7 @@ function App() {
...prev,
{
type: "ai_edit",
- parent: parentVersion,
+ parentIndex: parentVersion,
code,
inputs: {
prompt: updateInstruction,
diff --git a/frontend/src/components/history/HistoryDisplay.tsx b/frontend/src/components/history/HistoryDisplay.tsx
index beb78a25..767319ba 100644
--- a/frontend/src/components/history/HistoryDisplay.tsx
+++ b/frontend/src/components/history/HistoryDisplay.tsx
@@ -54,9 +54,9 @@ export default function HistoryDisplay({
>
<div className="flex gap-x-1">
<h2 className="text-sm">{displayHistoryItemType(item.type)}</h2>
- {item.parent && item.parent !== index - 1 ? (
+ {item.parentIndex && item.parentIndex !== index - 1 ? (
<h2 className="text-sm">
- (parent: v{(item.parent || 0) + 1})
+ (parent: v{(item.parentIndex || 0) + 1})
</h2>
) : null}
</div>
diff --git a/frontend/src/components/history/utils.test.ts b/frontend/src/components/history/utils.test.ts
index 2f0a34e6..c434f9b4 100644
--- a/frontend/src/components/history/utils.test.ts
+++ b/frontend/src/components/history/utils.test.ts
@@ -1,26 +1,27 @@
import { expect, test } from "vitest";
import { extractHistoryTree } from "./utils";
+import type { History } from "../../history_types";
-const data = [
+const data: History = [
{
- type: "ai_create" as const,
- parent: null,
+ type: "ai_create",
+ parentIndex: null,
code: "<html>1. create</html>",
inputs: {
image_url: "",
},
},
{
- type: "ai_edit" as const,
- parent: 0,
+ type: "ai_edit",
+ parentIndex: 0,
code: "<html>2. edit with better icons</html>",
inputs: {
prompt: "use better icons",
},
},
{
- type: "ai_edit" as const,
- parent: 1,
+ type: "ai_edit",
+ parentIndex: 1,
code: "<html>3. edit with better icons and red text</html>",
inputs: {
prompt: "make text red",
diff --git a/frontend/src/history_types.ts b/frontend/src/history_types.ts
index 48265954..55ca3f46 100644
--- a/frontend/src/history_types.ts
+++ b/frontend/src/history_types.ts
@@ -1,7 +1,7 @@
export type HistoryItemType = "ai_create" | "ai_edit";
type CommonHistoryItem = {
- parent: null | number;
+ parentIndex: null | number;
code: string;
};