From 71741466d8a876bf8111e94b776b589bde1803d8 Mon Sep 17 00:00:00 2001 From: Quinta <0pietroquintavalle0@gmail.com> Date: Thu, 20 Jun 2024 00:17:55 +0200 Subject: [PATCH] Fixing --- app/editor/page.tsx | 7 ----- components/codeeditor.tsx | 60 --------------------------------------- 2 files changed, 67 deletions(-) delete mode 100644 app/editor/page.tsx delete mode 100644 components/codeeditor.tsx diff --git a/app/editor/page.tsx b/app/editor/page.tsx deleted file mode 100644 index ba53751..0000000 --- a/app/editor/page.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import CodeEditor from "../../components/codeeditor" - -export default function JavaCodeEditor() { - return ( - - ) -} diff --git a/components/codeeditor.tsx b/components/codeeditor.tsx deleted file mode 100644 index 4ea90a2..0000000 --- a/components/codeeditor.tsx +++ /dev/null @@ -1,60 +0,0 @@ -"use client"; -import { Button } from "@/components/ui/button"; -import { useState } from "react"; -import Editor from "@monaco-editor/react"; - -export default function CodeEditor() { - const [code, setCode] = useState("// Write your Java code here"); - const [output, setOutput] = useState(""); - - const handleRunCode = async () => { - try { - const response = await fetch("/api/run-code", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ code }), - }); - - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - - const result = await response.json(); - setOutput(result.output || result.error); - } catch (error) { - console.error("Error running code:", error); - setOutput(error.message); - } - }; - - return ( -
-
-
-
-

Java Code Editor

- -
-
- setCode(value || "")} - className="h-full w-full p-4 text-sm" - /> -
-
-
-
-

Output

-
-
{output}
-
-
-
- ); -}