({
session,
active,
disabled,
onClick,
onDelete,
}: {
session: SessionItem;
active: boolean;
disabled: boolean;
onClick: () => void;
onDelete: () => void;
})
| 46 | } |
| 47 | |
| 48 | function SessionRow({ |
| 49 | session, |
| 50 | active, |
| 51 | disabled, |
| 52 | onClick, |
| 53 | onDelete, |
| 54 | }: { |
| 55 | session: SessionItem; |
| 56 | active: boolean; |
| 57 | disabled: boolean; |
| 58 | onClick: () => void; |
| 59 | onDelete: () => void; |
| 60 | }) { |
| 61 | const showBadge = session.runStatus && session.runStatus !== 'idle'; |
| 62 | |
| 63 | return ( |
| 64 | <div className="group relative"> |
| 65 | <button |
| 66 | type="button" |
| 67 | onClick={onClick} |
| 68 | disabled={disabled} |
| 69 | className={[ |
| 70 | 'flex w-full items-start gap-3 rounded-xl px-3 py-2 pr-8 text-left text-[13px] transition-all', |
| 71 | active ? 'bg-[#EFE8DD] text-[#241F17]' : 'text-[#4B4337] hover:bg-[#F1ECE3]', |
| 72 | disabled ? 'cursor-not-allowed opacity-70' : '', |
| 73 | ].join(' ')} |
| 74 | > |
| 75 | <span |
| 76 | className={[ |
| 77 | 'mt-1 h-2.5 w-2.5 rounded-full border border-[#B4A796] transition-colors', |
| 78 | active ? 'bg-[#B4A796]' : 'bg-transparent', |
| 79 | ].join(' ')} |
| 80 | /> |
| 81 | <span className="min-w-0 flex-1"> |
| 82 | <span className="block truncate">{session.summary || 'claw-code 会话'}</span> |
| 83 | {showBadge ? ( |
| 84 | <span |
| 85 | className={[ |
| 86 | 'mt-1 inline-flex rounded-full border px-2 py-0.5 text-[10px]', |
| 87 | sessionRunTone(session.runStatus), |
| 88 | ].join(' ')} |
| 89 | > |
| 90 | {labelForSessionRunStatus(session.runStatus)} |
| 91 | </span> |
| 92 | ) : null} |
| 93 | </span> |
| 94 | </button> |
| 95 | {!disabled && ( |
| 96 | <button |
| 97 | type="button" |
| 98 | onClick={(e) => { e.stopPropagation(); onDelete(); }} |
| 99 | className="absolute right-1.5 top-1/2 -translate-y-1/2 hidden items-center justify-center rounded-md p-1 text-[#A09382] transition-colors hover:bg-[#E5DCCD] hover:text-[#6B5E4F] group-hover:flex" |
| 100 | title="删除会话" |
| 101 | > |
| 102 | <Trash2 size={13} /> |
| 103 | </button> |
| 104 | )} |
| 105 | </div> |
nothing calls this directly
no test coverage detected