| 71 | useEffect(() => { setCopyStatus(''); }, [level, logs.data]); |
| 72 | |
| 73 | const copyLogs = async () => { |
| 74 | try { |
| 75 | if (!navigator.clipboard?.writeText) throw new Error('Clipboard access is unavailable. Select and copy the visible text.'); |
| 76 | await navigator.clipboard.writeText(logRows ? logRows.map(({ record, count }) => `${record.ts} ${record.level.toUpperCase()} ${record.source} #${record.id}${count > 1 ? ` ×${count}` : ''}\n${record.message}`).join('\n') : visibleLines.join('\n')); |
| 77 | setCopyStatus('Visible lines copied'); |
| 78 | } catch (error) { |
| 79 | setCopyStatus(error instanceof Error ? error.message : 'Could not copy the log.'); |
| 80 | } |
| 81 | }; |
| 82 | const moveTab = (event: KeyboardEvent<HTMLButtonElement>, current: SystemTab) => { |
| 83 | const index = TABS.indexOf(current); |
| 84 | const target = event.key === 'ArrowDown' ? TABS[(index + 1) % TABS.length] |