diff --git a/src/pages/EditorComponent.js b/src/pages/EditorComponent.js index c2691d3..0e6a0d4 100644 --- a/src/pages/EditorComponent.js +++ b/src/pages/EditorComponent.js @@ -5,41 +5,7 @@ import "../components/css/EditorComponent.css"; // Optional for styling import "@fortawesome/fontawesome-free/css/all.css"; import { useSnackbar } from "notistack"; import {Button, CircularProgress, styled} from "@mui/material"; - -const judge0SubmitUrl = - process.env.JUDGE0_SUMBISSION_URL || process.env.REACT_APP_RAPID_API_URL; -const rapidApiHost = process.env.REACT_APP_RAPID_API_HOST; -const rapidApiKey = process.env.REACT_APP_RAPID_API_KEY; - -const LANGUAGE_ID_FOR_JAVASCRIPT = 63; -const LANGUAGE_ID_FOR_PYTHON3 = 71; -const LANGUAGE_ID_FOR_CPP = 76; -const LANGUAGES = [ - { - ID: LANGUAGE_ID_FOR_JAVASCRIPT, - NAME: "Javascript", - DEFAULT_LANGUAGE: "javascript", - HELLO_WORLD:"console.log('Hello World');", - }, - { - ID: LANGUAGE_ID_FOR_PYTHON3, - NAME: "Python3", - DEFAULT_LANGUAGE: "python", - HELLO_WORLD:"print('Hello World')" - }, - { - ID: LANGUAGE_ID_FOR_CPP, - NAME: "C++", - DEFAULT_LANGUAGE: "C++(Clang 7.0.1)", - HELLO_WORLD: `#include -using namespace std; -int main() -{ - cout<<"Hello World"< { + const language = LANGUAGES.find(lang => lang.ID == id); + return language ? language.LOGO : null; + }; + // Function to handle code submission async function submitCode() { const codeToSubmit = editorRef.current.getValue(); @@ -169,12 +136,7 @@ function EditorComponent() {
{/* Current Language Logo */}
- {currentLanguage === LANGUAGES[0].DEFAULT_LANGUAGE ? ( - - ) : ( - - )} - + {getLanguageLogoById(languageDetails.LANGUAGE_ID)}
{languageDetails.LANGUAGE_NAME}
@@ -258,87 +220,4 @@ const styles = { }, }; -function JavascriptLogo({ width = 40, height = 40 }) { - return ( - - - - - - - - - - - ); -} - -function PythonLogo({ width = 40, height = 40 }) { - return ( - - - - - - - - - - - ); -} - export default EditorComponent;