/** * Generic timeline item interface. * Consumers map their domain models (Goals, Beads, etc.) to this shape. */ export interface TimelineItem { id: string title: string description?: string status: string category?: string progress?: number // 0-100 startDate?: string | null endDate?: string | null createdAt?: string children?: TimelineItem[] } /** * Dependency between two timeline items. */ export interface TimelineDependency { fromId: string toId: string type?: string } export type HealthStatus = 'on_track' | 'at_risk' | 'blocked' | 'not_started' export interface GanttTask { item: TimelineItem start: Date end: Date progress: number timeProgress: number depth: number hasChildren: boolean parentId: string | null healthStatus: HealthStatus } export interface GanttFilterState { search: string statuses: string[] categories: string[] dateRange: { start: Date | null; end: Date | null } } export type GanttViewMode = 'timeline' | 'board' | 'list' export interface GanttChartProps { /** Items to display on the timeline */ items: TimelineItem[] /** Optional dependencies between items */ dependencies?: TimelineDependency[] /** Callback when an item is clicked */ onItemClick?: (item: TimelineItem) => void /** Callback when dates are changed via drag */ onDateChange?: (id: string, startDate: Date, endDate: Date) => void /** Callback when an item is edited via the detail modal. Return updated item or void. */ onItemEdit?: (id: string, changes: Partial) => void /** Callback when item status changes (e.g. board drag-and-drop) */ onStatusChange?: (id: string, newStatus: string) => void /** Map a status string to a progress value (0-100) */ statusToProgress?: (status: string) => number /** Map a category string to a bar color */ categoryColors?: Record /** Whether items have hierarchy via children[] arrays. Default: true */ hierarchical?: boolean /** Initial zoom index (0-5). Default: 3 */ initialZoom?: number /** Custom CSS class for the wrapper */ className?: string /** Info column header label. Default: 'Item' */ infoColumnLabel?: string /** Info column width in px. Default: 320 */ infoColumnWidth?: number /** Show category badge in info column. Default: true */ showCategory?: boolean /** Show status badge in info column. Default: true */ showStatus?: boolean /** Show filter bar above the gantt. Default: false */ showFilterBar?: boolean /** Show fullscreen toggle button. Default: false */ showFullscreen?: boolean /** Show view mode switcher (timeline/board/list). Default: false */ showViewSwitcher?: boolean /** Initial view mode. Default: 'timeline' */ initialViewMode?: GanttViewMode /** Available statuses for the board view columns. If not provided, extracted from items. */ boardStatuses?: string[] /** localStorage key for persisting collapse state. If set, collapse state is saved/restored. */ persistCollapseKey?: string }