import { useRef, useEffect } from 'react'; import Editor from '@monaco-editor/react'; import { motion } from 'framer-motion'; import { Code2, Loader2, Send } from 'lucide-react'; import clsx from 'clsx'; export default function CodeEditor({ code, onCodeChange, onRunStep, isRunning, isThinking, stepCount, isDone, }) { const editorRef = useRef(null); function handleMount(editor) { editorRef.current = editor; editor.updateOptions({ fontSize: 13, lineHeight: 22, minimap: { enabled: false }, scrollBeyondLastLine: false, renderLineHighlight: 'gutter', padding: { top: 12, bottom: 12 }, fontFamily: "'JetBrains Mono', 'Fira Code', monospace", fontLigatures: true, cursorBlinking: 'smooth', smoothScrolling: true, bracketPairColorization: { enabled: true }, }); } // Auto-resize height based on content useEffect(() => { if (editorRef.current) { editorRef.current.layout(); } }, [code]); return (