feat: remove the ai toggle switch
This commit is contained in:
parent
4ebd6dea96
commit
06118e98e9
@ -78,7 +78,6 @@ export default function CodeEditor({
|
||||
useState<monaco.editor.IStandaloneCodeEditor>()
|
||||
|
||||
// AI Copilot state
|
||||
const [ai, setAi] = useState(false)
|
||||
const [generate, setGenerate] = useState<{
|
||||
show: boolean
|
||||
id: string
|
||||
@ -260,15 +259,6 @@ export default function CodeEditor({
|
||||
}, [editorRef])
|
||||
// Generate widget effect
|
||||
useEffect(() => {
|
||||
if (!ai) {
|
||||
setGenerate((prev) => {
|
||||
return {
|
||||
...prev,
|
||||
show: false,
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
if (generate.show) {
|
||||
setShowSuggestion(false)
|
||||
editorRef?.changeViewZones(function (changeAccessor) {
|
||||
@ -387,8 +377,6 @@ export default function CodeEditor({
|
||||
decorations.instance?.clear()
|
||||
}
|
||||
|
||||
if (!ai) return
|
||||
|
||||
const model = editorRef?.getModel()
|
||||
const line = model?.getLineContent(cursorLine)
|
||||
|
||||
@ -745,7 +733,7 @@ export default function CodeEditor({
|
||||
<div ref={generateRef} />
|
||||
<div ref={suggestionRef} className="absolute">
|
||||
<AnimatePresence>
|
||||
{isSelected && ai && showSuggestion && (
|
||||
{isSelected && showSuggestion && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
@ -761,7 +749,7 @@ export default function CodeEditor({
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
<div className="z-50 p-1" ref={generateWidgetRef}>
|
||||
{generate.show && ai ? (
|
||||
{generate.show ? (
|
||||
<GenerateInput
|
||||
user={userData}
|
||||
socket={socket!}
|
||||
@ -857,9 +845,6 @@ export default function CodeEditor({
|
||||
setFiles={setFiles}
|
||||
addNew={(name, type) => addNew(name, type, setFiles, sandboxData)}
|
||||
deletingFolderId={deletingFolderId}
|
||||
// AI Copilot Toggle
|
||||
ai={ai}
|
||||
setAi={setAi}
|
||||
/>
|
||||
|
||||
{/* Shadcn resizeable panels: https://ui.shadcn.com/docs/components/resizable */}
|
||||
|
@ -32,8 +32,6 @@ export default function Sidebar({
|
||||
socket,
|
||||
setFiles,
|
||||
addNew,
|
||||
ai,
|
||||
setAi,
|
||||
deletingFolderId,
|
||||
}: {
|
||||
sandboxData: Sandbox;
|
||||
@ -50,8 +48,6 @@ export default function Sidebar({
|
||||
socket: Socket;
|
||||
setFiles: (files: (TFile | TFolder)[]) => void;
|
||||
addNew: (name: string, type: "file" | "folder") => void;
|
||||
ai: boolean;
|
||||
setAi: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
deletingFolderId: string;
|
||||
}) {
|
||||
const ref = useRef(null); // drop target
|
||||
@ -186,20 +182,6 @@ export default function Sidebar({
|
||||
</div>
|
||||
</div>
|
||||
<div className="w-full space-y-4">
|
||||
<div className="flex items-center justify-between w-full">
|
||||
<div className="flex items-center">
|
||||
<Sparkles
|
||||
className={`h-4 w-4 mr-2 ${
|
||||
ai ? "text-indigo-500" : "text-muted-foreground"
|
||||
}`}
|
||||
/>
|
||||
Copilot{" "}
|
||||
<span className="font-mono text-muted-foreground inline-block ml-1.5 text-xs leading-none border border-b-2 border-muted-foreground py-1 px-1.5 rounded-md">
|
||||
⌘G
|
||||
</span>
|
||||
</div>
|
||||
<Switch checked={ai} onCheckedChange={setAi} />
|
||||
</div>
|
||||
{/* <Button className="w-full">
|
||||
<MonitorPlay className="w-4 h-4 mr-2" /> Run
|
||||
</Button> */}
|
||||
|
Loading…
x
Reference in New Issue
Block a user