interface Props {
  content: string
  runtime: string
}

export default function ScriptViewer({ content, runtime }: Props) {
  return (
    <div className="bg-gray-900 border border-gray-700 rounded-lg overflow-hidden">
      <div className="flex items-center justify-between px-4 py-2 bg-gray-800/50 border-b border-gray-700">
        <span className="text-xs text-gray-400 font-mono">script.{runtime === 'node' ? 'js' : runtime === 'python3' ? 'py' : runtime}</span>
        <button
          onClick={() => navigator.clipboard.writeText(content)}
          className="text-xs text-gray-500 hover:text-blue-400 transition-colors"
        >
          复制内容
        </button>
      </div>
      <pre className="p-4 text-sm font-mono overflow-x-auto leading-relaxed text-gray-200">
        {content}
      </pre>
    </div>
  )
}
