From 1b692b8cde4a888c8a35af69231f181b57bf5619 Mon Sep 17 00:00:00 2001 From: soryu Date: Fri, 6 Feb 2026 20:06:30 +0000 Subject: Fix: Cleanup old chain code --- .../src/components/directives/DirectiveList.tsx | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 makima/frontend/src/components/directives/DirectiveList.tsx (limited to 'makima/frontend/src/components/directives/DirectiveList.tsx') diff --git a/makima/frontend/src/components/directives/DirectiveList.tsx b/makima/frontend/src/components/directives/DirectiveList.tsx new file mode 100644 index 0000000..d0371e0 --- /dev/null +++ b/makima/frontend/src/components/directives/DirectiveList.tsx @@ -0,0 +1,85 @@ +import { useState } from "react"; +import type { DirectiveSummary } from "../../lib/api"; +import { DirectiveListItem } from "./DirectiveListItem"; + +interface DirectiveListProps { + directives: DirectiveSummary[]; + loading: boolean; + onSelect: (id: string) => void; + onCreate: () => void; + selectedId?: string; + onArchive: (directive: DirectiveSummary) => void; +} + +export function DirectiveList({ + directives, + loading, + onSelect, + onCreate, + selectedId, + onArchive, +}: DirectiveListProps) { + const [filter, setFilter] = useState<"all" | "active" | "completed" | "failed">("all"); + + const filteredDirectives = directives.filter((d) => { + if (filter === "all") return true; + if (filter === "active") return ["draft", "planning", "active", "paused"].includes(d.status); + if (filter === "completed") return d.status === "completed"; + if (filter === "failed") return d.status === "failed"; + return true; + }); + + return ( +
+
+

Directives

+ +
+ + {/* Filters */} +
+ {(["all", "active", "completed", "failed"] as const).map((f) => ( + + ))} +
+ + {/* List */} +
+ {loading ? ( +
+

Loading...

+
+ ) : filteredDirectives.length === 0 ? ( +
+

No directives found

+
+ ) : ( + filteredDirectives.map((d) => ( + onSelect(d.id)} + onArchive={() => onArchive(d)} + /> + )) + )} +
+
+ ); +} -- cgit v1.2.3