'use client'; import type { GraphNode } from '../../lib/graph'; import type { PathWorkspace } from '../../lib/graph-view'; import type { BeadIssue } from '../../lib/types'; /** Props for an individual flow card in the dependency strip. */ interface FlowCardProps { /** The graph node data for this card. */ node: GraphNode; /** Whether this card is the currently selected/focused task. */ selected: boolean; /** Number of issues blocking this node. */ blockedBy: number; /** Number of issues this node blocks. */ blocks: number; /** Callback fired when the user clicks this card. */ onSelect: (id: string) => void; } /** Props for the DependencyFlowStrip component. */ interface DependencyFlowStripProps { /** The computed path workspace containing blockers, focus, and dependents. */ workspace: PathWorkspace; /** ID of the currently selected task, or null. */ selectedId: string | null; /** Map of issue ID to blocker/blocks counts. */ signalById: Map; /** Callback fired when the user selects a card. */ onSelect: (id: string) => void; } /** * Returns the Tailwind background color class for a status dot indicator. */ function statusDot(status: BeadIssue['status']): string { switch (status) { case 'open': return 'bg-sky-400'; case 'in_progress': return 'bg-amber-400'; case 'blocked': return 'bg-rose-500'; case 'deferred': return 'bg-slate-400'; case 'closed': return 'bg-emerald-400'; case 'pinned': return 'bg-violet-400'; case 'hooked': return 'bg-orange-400'; default: return 'bg-zinc-500'; } } /** * A compact card representing a single node in the dependency flow. * Shows ID, title, status, and blocker/blocks counts. */ function FlowCard({ node, selected, blockedBy, blocks, onSelect }: FlowCardProps) { return ( ); } /** * Renders a section header with a count badge. */ function SectionHeader({ label, count, color }: { label: string; count: number; color: string }) { return (
{label} {count}
); } /** * Renders the dependency flow as three responsive sections stacked vertically: * Blocked By, Selected/Focus, and Blocks (Dependents). * Each section uses a responsive wrapping grid so cards never overflow. * On larger screens the three sections sit side-by-side; on smaller screens they stack. */ import { useState } from 'react'; // ... (FlowCardProps, DependencyFlowStripProps, statusDot, FlowCard, SectionHeader definitions remain unchanged) /** * Renders the dependency flow as three responsive sections stacked vertically: * Blocked By, Selected/Focus, and Blocks (Dependents). * Each section uses a responsive wrapping grid so cards never overflow. * On larger screens the three sections sit side-by-side; on smaller screens they stack. */ export function DependencyFlowStrip({ workspace, selectedId, signalById, onSelect }: DependencyFlowStripProps) { const [minimized, setMinimized] = useState(false); // Flatten the multi-hop blocker/dependent arrays for display const blockerNodes = workspace.blockers.flat(); const dependentNodes = workspace.dependents.flat(); return (

Dependency Flow

{/* Responsive three-column layout: stacks on mobile, side-by-side on desktop */} {!minimized && (
{/* Blocked By section */}
{blockerNodes.length > 0 ? (
{blockerNodes.map((node) => ( ))}
) : (

No blockers

)}
{/* Selected / Focused task section */}
{workspace.focus ? ( ) : (

Select a task

)}
{/* Blocks (Dependents) section */}
{dependentNodes.length > 0 ? (
{dependentNodes.map((node) => ( ))}
) : (

No dependents

)}
)}
); }