mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
refactor(ai-optimized-editor):优化 AI 代码编辑器布局- 调整了编辑器组件的 CSS 类,使其充满整个可用空间
- 优化了 DiffEditor 和 Editor 组件的布局,使其在显示和隐藏时能正确占用空间 - 移除了不必要的高度属性,使编辑器能根据内容自适应高度
This commit is contained in:
parent
a54598853e
commit
a559734c30
@ -98,8 +98,8 @@ export function AIProblemEditor({
|
|||||||
}, [currentCode, problemId]);
|
}, [currentCode, problemId]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-4">
|
<div className="flex flex-col h-full w-full">
|
||||||
<div className="flex justify-between items-center">
|
<div className="flex justify-between items-center p-4">
|
||||||
<button
|
<button
|
||||||
onClick={handleOptimizeCode}
|
onClick={handleOptimizeCode}
|
||||||
disabled={isOptimizing || !currentCode}
|
disabled={isOptimizing || !currentCode}
|
||||||
@ -124,31 +124,33 @@ export function AIProblemEditor({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{showDiff ? (
|
<div className="flex-grow overflow-hidden">
|
||||||
<DiffEditor
|
{showDiff ? (
|
||||||
original={currentCode}
|
<DiffEditor
|
||||||
modified={optimizedCode}
|
original={currentCode}
|
||||||
language="typescript"
|
modified={optimizedCode}
|
||||||
theme="vs-dark"
|
language="typescript"
|
||||||
className="h-full w-full"
|
theme="vs-dark"
|
||||||
options={{
|
className="h-full w-full"
|
||||||
readOnly: true,
|
options={{
|
||||||
minimap: { enabled: false }
|
readOnly: true,
|
||||||
}}
|
minimap: { enabled: false }
|
||||||
/>
|
}}
|
||||||
) : (
|
/>
|
||||||
<Editor
|
) : (
|
||||||
height="500px"
|
<Editor
|
||||||
language="typescript"
|
language="typescript"
|
||||||
theme="vs-dark"
|
theme="vs-dark"
|
||||||
value={currentCode}
|
value={currentCode}
|
||||||
onChange={handleCodeChange}
|
onChange={handleCodeChange}
|
||||||
options={{
|
options={{
|
||||||
scrollBeyondLastLine: false,
|
scrollBeyondLastLine: false,
|
||||||
fontSize: 14
|
fontSize: 14
|
||||||
}}
|
}}
|
||||||
/>
|
className="h-full w-full"
|
||||||
)}
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user