(props: TaskGroupListItemProps)
| 43 | } |
| 44 | |
| 45 | export function TaskGroupListItem(props: TaskGroupListItemProps) { |
| 46 | const hasRunningWork = props.runningCount > 0; |
| 47 | const aggregateState = getAggregateVisualState(props); |
| 48 | const statusDescriptionId = `task-group-status-${props.groupId}`; |
| 49 | const paddingLeft = getSidebarItemPaddingLeft(props.depth); |
| 50 | const KindGlyph = props.kind === "workflow" ? Workflow : Layers3; |
| 51 | const showProgressFraction = props.kind !== "workflow"; |
| 52 | const statusParts: string[] = []; |
| 53 | if (props.runningCount > 0) { |
| 54 | statusParts.push(`${props.runningCount} running`); |
| 55 | } |
| 56 | if (props.queuedCount > 0) { |
| 57 | statusParts.push(`${props.queuedCount} queued`); |
| 58 | } |
| 59 | if (props.completedCount > 0) { |
| 60 | statusParts.push(`${props.completedCount} completed`); |
| 61 | } |
| 62 | if (props.interruptedCount > 0) { |
| 63 | statusParts.push(`${props.interruptedCount} interrupted`); |
| 64 | } |
| 65 | if (props.visibleCount !== props.totalCount) { |
| 66 | statusParts.push(`${props.visibleCount}/${props.totalCount} visible`); |
| 67 | } |
| 68 | |
| 69 | return ( |
| 70 | <div |
| 71 | role="button" |
| 72 | tabIndex={0} |
| 73 | aria-expanded={props.isExpanded} |
| 74 | aria-label={`${props.isExpanded ? "Collapse" : "Expand"} task group ${props.title}`} |
| 75 | aria-describedby={statusDescriptionId} |
| 76 | data-testid={`task-group-${props.groupId}`} |
| 77 | data-running={hasRunningWork} |
| 78 | data-aggregate-state={aggregateState} |
| 79 | className={cn( |
| 80 | "bg-surface-primary relative flex items-start rounded-l-sm py-2 pr-2 select-none transition-all duration-150 hover:bg-surface-secondary", |
| 81 | props.sectionId != null ? "ml-2" : "ml-0", |
| 82 | hasRunningWork && "bg-surface-secondary", |
| 83 | props.isSelected && "bg-surface-secondary" |
| 84 | )} |
| 85 | style={{ paddingLeft }} |
| 86 | onClick={() => { |
| 87 | props.onToggle(); |
| 88 | }} |
| 89 | onKeyDown={(event) => { |
| 90 | if (event.key === "Enter" || event.key === " ") { |
| 91 | event.preventDefault(); |
| 92 | props.onToggle(); |
| 93 | } |
| 94 | }} |
| 95 | > |
| 96 | {/* Leading slot mirrors agent rows: the sub-agent connector elbow lands on |
| 97 | the status dot center, so the header reads as part of the tree. */} |
| 98 | <StatusDot state={aggregateState} isSubAgent /> |
| 99 | {/* Expanded member rows keep their shared rail one-and-a-half indent steps |
| 100 | in (getTaskGroupMemberDepth), which is exactly this chevron's center - |
| 101 | the disclosure control visually anchors the member trunk. */} |
| 102 | <span |
nothing calls this directly
no test coverage detected