({ text }: { text: string })
| 20 | } |
| 21 | |
| 22 | function CopyButton({ text }: { text: string }) { |
| 23 | const [copied, setCopied] = useState(false); |
| 24 | return ( |
| 25 | <button |
| 26 | onClick={() => { |
| 27 | navigator.clipboard.writeText(text).then(() => { |
| 28 | setCopied(true); |
| 29 | setTimeout(() => setCopied(false), 2000); |
| 30 | }); |
| 31 | }} |
| 32 | className="p-1 rounded text-surface-400 hover:text-surface-200 hover:bg-surface-700 transition-colors" |
| 33 | title="Copy command" |
| 34 | > |
| 35 | {copied ? ( |
| 36 | <Check className="w-3.5 h-3.5 text-green-400" /> |
| 37 | ) : ( |
| 38 | <Copy className="w-3.5 h-3.5" /> |
| 39 | )} |
| 40 | </button> |
| 41 | ); |
| 42 | } |
| 43 | |
| 44 | // Parse exit code from result — bash tool often appends it |
| 45 | function parseExitCode(result: string): number | null { |
nothing calls this directly
no outgoing calls
no test coverage detected