({ logs, onHide }: LogsPanelProps)
| 8 | }; |
| 9 | |
| 10 | export function LogsPanel({ logs, onHide }: LogsPanelProps) { |
| 11 | return ( |
| 12 | <div className="mx-auto mb-3 w-full max-w-[980px] rounded-[18px] border border-[#E6DDCF] bg-white shadow-[0_18px_44px_rgba(88,66,39,0.06)]"> |
| 13 | <div className="flex items-center justify-between border-b border-[#F0E8DE] px-4 py-3 text-[12px] text-[#7F7467]"> |
| 14 | <span className="font-medium text-[#2C251D]">运行日志</span> |
| 15 | <button |
| 16 | type="button" |
| 17 | onClick={onHide} |
| 18 | className="inline-flex items-center gap-1 rounded-xl border border-[#E7DFD3] bg-[#FAF7F2] px-2.5 py-1 text-[12px] text-[#6D6256] hover:bg-white" |
| 19 | > |
| 20 | <X size={12} /> |
| 21 | 收起 |
| 22 | </button> |
| 23 | </div> |
| 24 | <div className="max-h-[240px] overflow-y-auto px-4 py-3"> |
| 25 | {logs.length > 0 ? ( |
| 26 | <div className="space-y-2"> |
| 27 | {logs.slice(-120).map(log => ( |
| 28 | <div |
| 29 | key={log.id} |
| 30 | className="rounded-2xl border border-[#EFE6DA] bg-[#FCFAF6] px-3 py-2.5" |
| 31 | > |
| 32 | <div className="flex items-center justify-between gap-3 text-[11px] text-[#8D8173]"> |
| 33 | <span className="font-medium text-[#5C5247]">{log.source}</span> |
| 34 | <span>{formatTimestamp(log.timestamp)}</span> |
| 35 | </div> |
| 36 | <div className="mt-1 whitespace-pre-wrap break-words font-mono text-[12px] leading-5 text-[#5C5247]"> |
| 37 | {log.text} |
| 38 | </div> |
| 39 | </div> |
| 40 | ))} |
| 41 | </div> |
| 42 | ) : ( |
| 43 | <div className="rounded-2xl border border-dashed border-[#E4DACD] px-4 py-5 text-[13px] text-[#978C7E]"> |
| 44 | 执行连接测试或开始对话后,日志会显示在这里。 |
| 45 | </div> |
| 46 | )} |
| 47 | </div> |
| 48 | </div> |
| 49 | ); |
| 50 | } |
nothing calls this directly
no test coverage detected