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([
{
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,

View File

@ -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>

View File

@ -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",

View File

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