From 4ebd6dea96b3c28a2b545009858e1c547e92538d Mon Sep 17 00:00:00 2001 From: James Murdza Date: Fri, 6 Sep 2024 18:13:42 -0700 Subject: [PATCH 1/2] fix: catch errors when copying files to the container --- backend/server/src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/server/src/index.ts b/backend/server/src/index.ts index c78272b..fe0690f 100644 --- a/backend/server/src/index.ts +++ b/backend/server/src/index.ts @@ -177,7 +177,7 @@ io.on("connection", async (socket) => { }; const sandboxFiles = await getSandboxFiles(data.sandboxId); - sandboxFiles.fileData.forEach(async (file) => { + const promises = sandboxFiles.fileData.map(async (file) => { const filePath = path.join(dirName, file.id); try { await containers[data.sandboxId].files.makeDir( @@ -188,6 +188,8 @@ io.on("connection", async (socket) => { } await containers[data.sandboxId].files.write(filePath, file.data); }); + await Promise.all(promises); + fixPermissions(); socket.emit("loaded", sandboxFiles.files); From 06118e98e91b760aeddb45becbf9ccbd30cc1c73 Mon Sep 17 00:00:00 2001 From: James Murdza Date: Fri, 6 Sep 2024 18:14:54 -0700 Subject: [PATCH 2/2] feat: remove the ai toggle switch --- frontend/components/editor/index.tsx | 19 ++----------------- frontend/components/editor/sidebar/index.tsx | 18 ------------------ 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/frontend/components/editor/index.tsx b/frontend/components/editor/index.tsx index 8abb9b0..f5750ee 100644 --- a/frontend/components/editor/index.tsx +++ b/frontend/components/editor/index.tsx @@ -78,7 +78,6 @@ export default function CodeEditor({ useState() // 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({
- {isSelected && ai && showSuggestion && ( + {isSelected && showSuggestion && (
- {generate.show && ai ? ( + {generate.show ? ( addNew(name, type, setFiles, sandboxData)} deletingFolderId={deletingFolderId} - // AI Copilot Toggle - ai={ai} - setAi={setAi} /> {/* Shadcn resizeable panels: https://ui.shadcn.com/docs/components/resizable */} diff --git a/frontend/components/editor/sidebar/index.tsx b/frontend/components/editor/sidebar/index.tsx index a3a1065..45fa643 100644 --- a/frontend/components/editor/sidebar/index.tsx +++ b/frontend/components/editor/sidebar/index.tsx @@ -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>; deletingFolderId: string; }) { const ref = useRef(null); // drop target @@ -186,20 +182,6 @@ export default function Sidebar({
-
-
- - Copilot{" "} - - ⌘G - -
- -
{/* */}