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}
-
-
-
- ); -}