import * as React from 'react'; import { ThemeProvider, createTheme } from '@mui/material/styles'; import { Backdrop, Button, CircularProgress, CssBaseline, Container, Link, Paper, Typography, TextField, } from '@mui/material'; import Graph from './graph.tsx'; const { useState, useCallback } = React; const darkTheme = createTheme({ palette: { mode: 'dark', }, }); const placeholder = `s(7). s(4). s(8). s(3). s(5). s(9). s(10). s(1). s(6). s(2). ac(7,c(v)). ac(4,6). ac(8,or(neg(1),7)). ac(3,and(or(7,neg(6)),2)). ac(5,4). ac(9,neg(7)). ac(10,and(neg(2),6)). ac(1,and(neg(7),2)). ac(6,neg(7)).ac(2,and(neg(9),neg(6))).`; enum Strategy { ParseOnly = 'ParseOnly', Ground = 'Ground', FirstComplete = 'FirstComplete', FirstStable = 'FirstStable', } function App() { const [loading, setLoading] = useState(false); const [code, setCode] = useState(placeholder); const [graph, setGraph] = useState(); const submitHandler = useCallback( (strategy: Strategy) => { setLoading(true); fetch(`${process.env.NODE_ENV === 'development' ? '//localhost:8080' : ''}/solve`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ code, strategy }), }) .then((res) => res.json()) .then((data) => setGraph(data)) .finally(() => setLoading(false)); // TODO: error handling }, [code], ); console.log(graph); return (
Solve your ADF Problem with Style! For more info on the syntax, have a look here. )} multiline fullWidth variant="filled" value={code} onChange={(event) => { setCode(event.target.value); }} /> {' '} {' '} {' '} {graph && ( )}
); } export default App;