mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-17 23:12:23 +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]);
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="flex justify-between items-center">
|
||||
<div className="flex flex-col h-full w-full">
|
||||
<div className="flex justify-between items-center p-4">
|
||||
<button
|
||||
onClick={handleOptimizeCode}
|
||||
disabled={isOptimizing || !currentCode}
|
||||
@ -124,31 +124,33 @@ export function AIProblemEditor({
|
||||
</div>
|
||||
)}
|
||||
|
||||
{showDiff ? (
|
||||
<DiffEditor
|
||||
original={currentCode}
|
||||
modified={optimizedCode}
|
||||
language="typescript"
|
||||
theme="vs-dark"
|
||||
className="h-full w-full"
|
||||
options={{
|
||||
readOnly: true,
|
||||
minimap: { enabled: false }
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<Editor
|
||||
height="500px"
|
||||
language="typescript"
|
||||
theme="vs-dark"
|
||||
value={currentCode}
|
||||
onChange={handleCodeChange}
|
||||
options={{
|
||||
scrollBeyondLastLine: false,
|
||||
fontSize: 14
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<div className="flex-grow overflow-hidden">
|
||||
{showDiff ? (
|
||||
<DiffEditor
|
||||
original={currentCode}
|
||||
modified={optimizedCode}
|
||||
language="typescript"
|
||||
theme="vs-dark"
|
||||
className="h-full w-full"
|
||||
options={{
|
||||
readOnly: true,
|
||||
minimap: { enabled: false }
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<Editor
|
||||
language="typescript"
|
||||
theme="vs-dark"
|
||||
value={currentCode}
|
||||
onChange={handleCodeChange}
|
||||
options={{
|
||||
scrollBeyondLastLine: false,
|
||||
fontSize: 14
|
||||
}}
|
||||
className="h-full w-full"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue
Block a user