import AceEditor from "react-ace"; import React, { useEffect, useState } from "react"; import "ace-builds/src-min-noconflict/ext-language_tools"; import "ace-builds/src-noconflict/mode-python"; import "ace-builds/src-noconflict/snippets/python"; import "ace-builds/src-noconflict/mode-javascript"; import "ace-builds/src-noconflict/snippets/javascript"; import "ace-builds/src-noconflict/theme-tomorrow_night_blue"; import { exoInstance } from "../../apis/exoInstance.instance.js"; import { useQuery } from "react-query"; import { editorOut } from "../../requests/requests.exos.js"; import styles from "../../styles/exos/Editor.module.scss"; import { VscDebugStart } from "react-icons/vsc"; import { parseClassName } from "../../utils/utils.js"; import { notificationService } from "../../services/notification.service.js"; function ConsoleComp({ content, step }) { return (

Python 3.10.1 (main, Dec 29 2021, 10:45:39) -{" "} {step.name.replace(" ", "_")}.py

{content.out.length == 0 && content.error.length == 0 && (

{">"}

)} {content.out.map((l) => { return (

{">"} {l}

); })} {content.error.map((l) => { return (

{">"} {l}

); })}
); } const Console = React.memo(ConsoleComp); export default function CustomEditor({ ...props }) { const [enable, setEnable] = useState(false); const { isLoading, isFetching, data, refetch, remove } = useQuery( "editor", async () => await editorOut(props.value), { refetchOnWindowFocus: false, staleTime: 1000000, enabled: enable, } ); useEffect(() => { return () => { remove(); }; }, []); return ( <>
Python - {props.filename != null ? props.filename: 'main.py'}
{" "}
Console
); }