diff --git a/frontend/src/components/history/HistoryDisplay.tsx b/frontend/src/components/history/HistoryDisplay.tsx index 8f0a06b..9f4d8fc 100644 --- a/frontend/src/components/history/HistoryDisplay.tsx +++ b/frontend/src/components/history/HistoryDisplay.tsx @@ -1,4 +1,4 @@ -import { History } from "./history_types"; +import { History, HistoryItemType } from "./history_types"; import toast from "react-hot-toast"; import classNames from "classnames"; import { @@ -6,6 +6,7 @@ import { HoverCardTrigger, HoverCardContent, } from "../ui/hover-card"; +import { Badge } from "../ui/badge"; interface Props { history: History; @@ -14,17 +15,18 @@ interface Props { shouldDisableReverts: boolean; } -// function displayHistoryItemType(itemType: HistoryItemType) { -// switch (itemType) { -// case "ai_create": -// return "Create"; -// case "ai_edit": -// return "Edit"; -// default: -// // TODO: Error out since this is exhaustive -// return "Unknown"; -// } -// } +function displayHistoryItemType(itemType: HistoryItemType) { + switch (itemType) { + case "ai_create": + return "Create"; + case "ai_edit": + return "Edit"; + default: { + const exhaustiveCheck: never = itemType; + throw new Error(`Unhandled case: ${exhaustiveCheck}`); + } + } +} export default function HistoryDisplay({ history, @@ -73,7 +75,10 @@ export default function HistoryDisplay({

v{index + 1}

- {item.type === "ai_edit" ? item.inputs.prompt : "Create"} +
+ {item.type === "ai_edit" ? item.inputs.prompt : "Create"} +
+ {displayHistoryItemType(item.type)}