template function for code check
This commit is contained in:
parent
c623773d46
commit
8be8666ba0
4 changed files with 19 additions and 4 deletions
|
|
@ -6,7 +6,7 @@ import {
|
||||||
XMarkIcon,
|
XMarkIcon,
|
||||||
} from "@heroicons/react/24/outline";
|
} from "@heroicons/react/24/outline";
|
||||||
import { MouseEventHandler, useContext, useEffect, useRef, useState } from "react";
|
import { MouseEventHandler, useContext, useEffect, useRef, useState } from "react";
|
||||||
import { sendAll } from "../../controllers/NodesServices";
|
import { sendAll } from "../../controllers/API";
|
||||||
import { alertContext } from "../../contexts/alertContext";
|
import { alertContext } from "../../contexts/alertContext";
|
||||||
import { classNames, nodeColors } from "../../utils";
|
import { classNames, nodeColors } from "../../utils";
|
||||||
import { TabsContext } from "../../contexts/tabsContext";
|
import { TabsContext } from "../../contexts/tabsContext";
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,8 @@ export async function getAll():Promise<AxiosResponse<APIObjectType>> {
|
||||||
|
|
||||||
export async function sendAll(data:sendAllProps) {
|
export async function sendAll(data:sendAllProps) {
|
||||||
return await axios.post(`/predict`, data);
|
return await axios.post(`/predict`, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function checkCode(code:string){
|
||||||
|
return []
|
||||||
}
|
}
|
||||||
|
|
@ -9,6 +9,7 @@ import "ace-builds/src-noconflict/theme-twilight";
|
||||||
import "ace-builds/src-noconflict/ext-language_tools"
|
import "ace-builds/src-noconflict/ext-language_tools"
|
||||||
import "ace-builds/webpack-resolver"
|
import "ace-builds/webpack-resolver"
|
||||||
import {darkContext} from "../../contexts/darkContext"
|
import {darkContext} from "../../contexts/darkContext"
|
||||||
|
import { checkCode } from "../../controllers/API";
|
||||||
export default function CodeAreaModal({
|
export default function CodeAreaModal({
|
||||||
value,
|
value,
|
||||||
setValue,
|
setValue,
|
||||||
|
|
@ -104,7 +105,7 @@ export default function CodeAreaModal({
|
||||||
enableLiveAutocompletion
|
enableLiveAutocompletion
|
||||||
theme={dark?"twilight":"github"}
|
theme={dark?"twilight":"github"}
|
||||||
name="CodeEditor"
|
name="CodeEditor"
|
||||||
onChange={(value)=>{setCode(value);setValue(value)}}
|
onChange={(value)=>{setCode(value)}}
|
||||||
className="h-full w-full rounded-lg"
|
className="h-full w-full rounded-lg"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -115,10 +116,20 @@ export default function CodeAreaModal({
|
||||||
type="button"
|
type="button"
|
||||||
className="inline-flex w-full justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm"
|
className="inline-flex w-full justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
setValue(code)
|
||||||
setModalOpen(false);
|
setModalOpen(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Finish editing
|
Save code
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="inline-flex w-full justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm"
|
||||||
|
onClick={() => {
|
||||||
|
checkCode(code)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Check Code
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import {
|
||||||
nodeNames,
|
nodeNames,
|
||||||
} from "../../../../utils";
|
} from "../../../../utils";
|
||||||
import { useContext, useEffect, useState } from "react";
|
import { useContext, useEffect, useState } from "react";
|
||||||
import { getAll } from "../../../../controllers/NodesServices";
|
import { getAll } from "../../../../controllers/API";
|
||||||
import { typesContext } from "../../../../contexts/typesContext";
|
import { typesContext } from "../../../../contexts/typesContext";
|
||||||
import { APIClassType, APIKindType, APIObjectType } from "../../../../types/api";
|
import { APIClassType, APIKindType, APIObjectType } from "../../../../types/api";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue