import { memo } from 'react' import { StyleSheet, Text, View } from 'react-native' import type { RuntimeWorktreeAgentRow } from '../../../src/shared/runtime-types' import { colors, spacing } from '../theme/mobile-theme' import { agentDisplayLabel, agentDotState, agentRowTimeAt, formatTimeAgo } from '../worktree/agent-row-display' import { AgentStateDot } from './AgentStateDot' import { MobileAgentIcon } from './MobileAgentIcon' const INDENT_PER_DEPTH = 14 type Props = { agent: RuntimeWorktreeAgentRow depth: number now: number // Bold/foreground until the user has visited the worktree, mirroring desktop's // unvisited rule (the workspace title and its agent rows share one signal). unvisited: boolean } // One inline agent row: state dot → identity → last message/prompt → time ago. // Mirrors desktop DashboardAgentRow's compact in-card layout. function WorktreeAgentRowComponent({ agent, depth, now, unvisited }: Props) { const dotState = agentDotState(agent, now) const label = agentDisplayLabel(agent, now) const ts = formatTimeAgo(agentRowTimeAt(agent), now) return ( {/* Agent identity logo (Claude/Codex/…), matching the desktop sidebar's agent icons instead of a two-letter text code. */} {agent.agentType ? : null} {label} {ts} ) } export const WorktreeAgentRow = memo(WorktreeAgentRowComponent) const styles = StyleSheet.create({ row: { flexDirection: 'row', alignItems: 'center', gap: spacing.xs, marginTop: 3 }, label: { flex: 1, fontSize: 11, color: colors.textMuted }, labelUnvisited: { color: colors.textPrimary, fontWeight: '600' }, time: { fontSize: 10, color: colors.textMuted } })