({ session, onDelete, deleting }: SessionCardProps)
| 10 | } |
| 11 | |
| 12 | export function SessionCard({ session, onDelete, deleting }: SessionCardProps) { |
| 13 | const { sessionId } = useParams<{ sessionId: string }>(); |
| 14 | const selected = sessionId === session.sessionId; |
| 15 | const workspaceLabel = session.workDir |
| 16 | ? session.workDir.split('/').slice(-2).join('/') |
| 17 | : '(no workspace)'; |
| 18 | const shortId = session.sessionId.replace(/^session_/, '').slice(0, 10); |
| 19 | const title = session.title; |
| 20 | const subagentCount = Math.max(0, session.agentCount - 1); |
| 21 | |
| 22 | function handleDeleteClick(e: MouseEvent<HTMLButtonElement>) { |
| 23 | e.preventDefault(); |
| 24 | e.stopPropagation(); |
| 25 | onDelete(session); |
| 26 | } |
| 27 | |
| 28 | return ( |
| 29 | <div |
| 30 | className={[ |
| 31 | 'group relative border-b border-border transition-colors', |
| 32 | selected ? 'bg-surface-2' : 'hover:bg-surface-1', |
| 33 | ].join(' ')} |
| 34 | > |
| 35 | {selected ? ( |
| 36 | <span className="absolute inset-y-0 left-0 w-[2px] bg-[var(--color-cat-conversation)]" /> |
| 37 | ) : null} |
| 38 | <Link to={`/sessions/${session.sessionId}`} className="block px-3 py-2 pr-10"> |
| 39 | <div className="flex items-center justify-between gap-2"> |
| 40 | <div className="flex min-w-0 items-center gap-2"> |
| 41 | <span |
| 42 | className="inline-block h-[7px] w-[7px] shrink-0 rounded-full" |
| 43 | style={{ backgroundColor: session.imported ? 'var(--color-cat-subagent)' : 'var(--color-fg-3)' }} |
| 44 | /> |
| 45 | <span className="shrink-0 font-mono text-[12px] text-fg-0">{shortId}</span> |
| 46 | {session.imported ? ( |
| 47 | <span |
| 48 | className="shrink-0 border px-1 py-0 font-mono text-[9px] uppercase tracking-[0.08em]" |
| 49 | style={{ borderColor: 'var(--color-cat-subagent)', color: 'var(--color-cat-subagent)' }} |
| 50 | title={ |
| 51 | session.importMeta?.originalName |
| 52 | ? `imported from ${session.importMeta.originalName}` |
| 53 | : 'imported debug bundle' |
| 54 | } |
| 55 | > |
| 56 | imported |
| 57 | </span> |
| 58 | ) : null} |
| 59 | </div> |
| 60 | <span className="shrink-0 font-mono text-[10.5px] text-fg-3 tabular"> |
| 61 | {formatRelativeTime(session.updatedAt)} |
| 62 | </span> |
| 63 | </div> |
| 64 | <div className="mt-1 flex items-center gap-3 font-mono text-[10.5px] text-fg-2"> |
| 65 | <span className="truncate" title={session.workDir ?? ''}> |
| 66 | {workspaceLabel} |
| 67 | </span> |
| 68 | <span className="tabular text-fg-3"> |
| 69 | {session.mainWireRecordCount}ev |
nothing calls this directly
no test coverage detected