import * as React from 'react'; import { ThemeProvider, createTheme } from '@mui/material/styles'; import { Backdrop, Button, CircularProgress, CssBaseline, Container, FormControl, FormControlLabel, FormLabel, Link, Pagination, Paper, Radio, RadioGroup, Typography, TextField, } from '@mui/material'; import GraphG6 from './graph-g6.tsx'; const { useState, useCallback } = React; const darkTheme = createTheme({ palette: { mode: 'dark', }, }); const placeholder = `s(a). s(b). s(c). s(d). ac(a,c(v)). ac(b,b). ac(c,and(a,b)). ac(d,neg(b)).`; enum Parsing { Naive = 'Naive', Hybrid = 'Hybrid', } enum Strategy { ParseOnly = 'ParseOnly', Ground = 'Ground', Complete = 'Complete', Stable = 'Stable', StableCountingA = 'StableCountingA', StableCountingB = 'StableCountingB', StableNogood = 'StableNogood', } function App() { const [loading, setLoading] = useState(false); const [code, setCode] = useState(placeholder); const [parsing, setParsing] = useState(Parsing.Naive); const [graphs, setGraphs] = useState(); const [graphIndex, setGraphIndex] = useState(0); 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, parsing }), }) .then((res) => res.json()) .then((data) => { setGraphs(data); setGraphIndex(0); }) .finally(() => setLoading(false)); // TODO: error handling }, [code, parsing], ); return (
Solve your ADF Problem with OBDDs! For more info on the syntax, have a look {' '} here . )} multiline fullWidth variant="filled" value={code} onChange={(event) => { setCode(event.target.value); }} /> Parsing Strategy setParsing((e.target as HTMLInputElement).value)} > } label="Naive" /> } label="Hybrid" />

{' '} {' '} {' '} {' '} {' '} {' '}
{graphs && ( {graphs.length > 1 && ( <> Models:
setGraphIndex(value - 1)} /> )} {graphs.length > 0 && ( )} {graphs.length === 0 && <>No models!}
)}
); } export default App;