import { Box } from "ink"; import type React from "react"; import { useTerminalWidth } from "../hooks/useTerminalWidth.js"; import { colors } from "./colors.js"; import { Text } from "./Text"; interface PlanItem { step: string; status: "pending" | "in_progress" | "completed"; } interface PlanRendererProps { plan: PlanItem[]; explanation?: string; } export const PlanRenderer: React.FC = ({ plan, explanation, }) => { const columns = useTerminalWidth(); const prefixWidth = 5; // " ⎿ " or " " const contentWidth = Math.max(0, columns - prefixWidth); return ( {explanation && ( {" ⎿ "} {explanation} )} {plan.map((item, index) => { const checkbox = item.status === "completed" ? "☒" : "☐"; // Format based on status let textElement: React.ReactNode; if (item.status === "completed") { // Green with strikethrough textElement = ( {checkbox} {item.step} ); } else if (item.status === "in_progress") { // Blue bold textElement = ( {checkbox} {item.step} ); } else { // Plain text for pending textElement = ( {checkbox} {item.step} ); } // First item (or first after explanation) gets the prefix, others get indentation const prefix = index === 0 && !explanation ? " ⎿ " : " "; return ( {prefix} {textElement} ); })} ); };