import React, { useState, useMemo } from "react"; import type { Phase } from "../types"; interface DocumentPaneProps { content: string; onChange: (content: string) => void; phase: Phase; disabled: boolean; showOnboarding?: boolean; } function renderTable(tableLines: string[]): string { if (tableLines.length < 2) return tableLines.join("\n"); const parseRow = (line: string): string[] => { return line .split("|") .slice(1, -1) // Remove empty first/last from |col|col| .map((cell) => cell.trim()); }; const headerCells = parseRow(tableLines[0]); // Skip separator row (index 1) const bodyRows = tableLines.slice(2); let html = '
| ${cell} | `; }); html += '
|---|
| ${cell} | `; }); html += '
$2'
)
.replace(/`([^`]+)`/g, "$1")
// Lists
.replace(/^- \[x\] (.*$)/gm, '") .replace(/^(.+)$/gm, "
$1
") // Clean up .replace(/<\/p>/g, "") .replace(/
( ( ( (
A structured workflow for AI-assisted coding: Research → Plan → Implement.
Export your Anthropic API key: Get one at platform.claude.com Research: Claude analyzes your codebase and writes findings to Plan: Claude drafts an implementation plan in Implement: Claude executes the plan, marking tasks complete as it goes. Iterate on research and plan docs as long as you want. Click Submit when happy to move to the next phase.)/g, "$1")
.replace(/(<\/pre>)<\/p>/g, "$1")
.replace(/)/g, "$1")
.replace(/(<\/table>)<\/p>/g, "$1")
);
}
export function DocumentPane({
content,
onChange,
phase,
disabled,
showOnboarding,
}: DocumentPaneProps) {
const [isEditing, setIsEditing] = useState(false);
const renderedHtml = useMemo(() => renderMarkdown(content), [content]);
if (showOnboarding) {
return (
Claude Flow
Setup
export ANTHROPIC_API_KEY=your-key-hereGetting Started
Workflow
research.md. Add notes like // REVIEW: check this — click Review when done.plan.md with code snippets and a TODO list. Iterate the same way.