diff --git a/packages/web/src/components/DecisionList.tsx b/packages/web/src/components/DecisionList.tsx new file mode 100644 index 0000000..78e81f0 --- /dev/null +++ b/packages/web/src/components/DecisionList.tsx @@ -0,0 +1,96 @@ +import { useState } from "react"; +import { ChevronDown, ChevronRight } from "lucide-react"; +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; + +export interface Decision { + topic: string; + decision: string; + reason: string; +} + +interface DecisionListProps { + decisions: Decision[]; + maxVisible?: number; +} + +export function DecisionList({ decisions, maxVisible = 3 }: DecisionListProps) { + const [expandedIndices, setExpandedIndices] = useState>( + new Set() + ); + const [showAll, setShowAll] = useState(false); + + function toggleDecision(index: number) { + setExpandedIndices((prev) => { + const next = new Set(prev); + if (next.has(index)) { + next.delete(index); + } else { + next.add(index); + } + return next; + }); + } + + const visibleDecisions = showAll + ? decisions + : decisions.slice(0, maxVisible); + const hasMore = decisions.length > maxVisible; + + return ( + + + Key Decisions + + + {decisions.length === 0 ? ( +

+ No decisions recorded +

+ ) : ( +
+ {visibleDecisions.map((d, i) => { + const isExpanded = expandedIndices.has(i); + return ( +
+ + {isExpanded && ( +
+

{d.decision}

+

+ Reason: {d.reason} +

+
+ )} +
+ ); + })} + {hasMore && ( + + )} +
+ )} +
+
+ ); +}