update name

This commit is contained in:
Abi Raja 2023-12-07 09:38:42 -05:00
parent dd0f3b7648
commit 2457a3f5bd
4 changed files with 13 additions and 12 deletions

View File

@ -146,7 +146,7 @@ function App() {
setAppHistory([ setAppHistory([
{ {
type: "ai_create", type: "ai_create",
parent: null, parentIndex: null,
code, code,
inputs: { image_url: referenceImages[0] }, inputs: { image_url: referenceImages[0] },
}, },
@ -166,7 +166,7 @@ function App() {
...prev, ...prev,
{ {
type: "ai_edit", type: "ai_edit",
parent: parentVersion, parentIndex: parentVersion,
code, code,
inputs: { inputs: {
prompt: updateInstruction, prompt: updateInstruction,

View File

@ -54,9 +54,9 @@ export default function HistoryDisplay({
> >
<div className="flex gap-x-1"> <div className="flex gap-x-1">
<h2 className="text-sm">{displayHistoryItemType(item.type)}</h2> <h2 className="text-sm">{displayHistoryItemType(item.type)}</h2>
{item.parent && item.parent !== index - 1 ? ( {item.parentIndex && item.parentIndex !== index - 1 ? (
<h2 className="text-sm"> <h2 className="text-sm">
(parent: v{(item.parent || 0) + 1}) (parent: v{(item.parentIndex || 0) + 1})
</h2> </h2>
) : null} ) : null}
</div> </div>

View File

@ -1,26 +1,27 @@
import { expect, test } from "vitest"; import { expect, test } from "vitest";
import { extractHistoryTree } from "./utils"; import { extractHistoryTree } from "./utils";
import type { History } from "../../history_types";
const data = [ const data: History = [
{ {
type: "ai_create" as const, type: "ai_create",
parent: null, parentIndex: null,
code: "<html>1. create</html>", code: "<html>1. create</html>",
inputs: { inputs: {
image_url: "", image_url: "",
}, },
}, },
{ {
type: "ai_edit" as const, type: "ai_edit",
parent: 0, parentIndex: 0,
code: "<html>2. edit with better icons</html>", code: "<html>2. edit with better icons</html>",
inputs: { inputs: {
prompt: "use better icons", prompt: "use better icons",
}, },
}, },
{ {
type: "ai_edit" as const, type: "ai_edit",
parent: 1, parentIndex: 1,
code: "<html>3. edit with better icons and red text</html>", code: "<html>3. edit with better icons and red text</html>",
inputs: { inputs: {
prompt: "make text red", prompt: "make text red",

View File

@ -1,7 +1,7 @@
export type HistoryItemType = "ai_create" | "ai_edit"; export type HistoryItemType = "ai_create" | "ai_edit";
type CommonHistoryItem = { type CommonHistoryItem = {
parent: null | number; parentIndex: null | number;
code: string; code: string;
}; };