import { ChevronDown, ChevronRight, GitBranch, Pencil } from "lucide-react"; import { useState } from "react"; import { useTranslation } from "react-i18next"; import type { MobileWorkflowNodeSummary } from "./workflow-mobile-graph"; import "./MobileWorkflowGraphView.css"; interface MobileWorkflowGraphViewProps { rows: MobileWorkflowNodeSummary[]; selectedNodeId?: string | null; selectedEdgeId?: string | null; onSelectNode: (id: string) => void; onSelectEdge: (id: string) => void; } function NodeRow({ row, depth, selectedNodeId, selectedEdgeId, onSelectNode, onSelectEdge, }: { row: MobileWorkflowNodeSummary; depth: number; selectedNodeId?: string | null; selectedEdgeId?: string | null; onSelectNode: (id: string) => void; onSelectEdge: (id: string) => void; }) { const { t } = useTranslation("app"); const hasChildren = row.children.length > 0; const [expanded, setExpanded] = useState(depth === 0); const selected = selectedNodeId === row.id; return (
{hasChildren ? ( ) : null}
{(row.columnName || row.outgoing.length > 0) && (
{row.columnName ? {row.columnName} : null} {row.outgoing.map((edge) => ( ))}
)} {hasChildren && expanded ? (
{row.children.map((child) => ( ))}
) : null}
); } export function MobileWorkflowGraphView({ rows, selectedNodeId, selectedEdgeId, onSelectNode, onSelectEdge, }: MobileWorkflowGraphViewProps) { const { t } = useTranslation("app"); if (rows.length === 0) { return (
{t("workflowNodes.mobileGraphEmpty", "No graph nodes yet.")}
); } return (
{rows.map((row) => ( ))}
); }