diff --git a/src/App.js b/src/App.js index ae4c60d..5f885ce 100644 --- a/src/App.js +++ b/src/App.js @@ -20,7 +20,7 @@ class App extends React.Component { initialCSS: 'initial', canvasOpen: false, popupOpen: false, - fitchStyle: true, + fitchStyle: localStorage.getItem('fitchStyle') === 'true', filename: '', proof: { premises: [], @@ -106,6 +106,7 @@ class App extends React.Component { } setStyle(bool) { + localStorage.setItem('fitchStyle', bool); this.setState({ fitchStyle: bool }); } @@ -115,6 +116,8 @@ class App extends React.Component {
diff --git a/src/canvas/Canvas.js b/src/canvas/Canvas.js index 96a093c..3b8a4cf 100644 --- a/src/canvas/Canvas.js +++ b/src/canvas/Canvas.js @@ -11,6 +11,8 @@ import DropdownMenu from './DropdownMenu'; import config from './config'; import manipulate from './manipulate'; import { CSSTransitionGroup } from 'react-transition-group'; +import Switch from "react-switch"; + // KATEX import 'katex/dist/katex.min.css'; import TeX from '@matejmazur/react-katex'; @@ -398,6 +400,7 @@ class Canvas extends React.Component { if (steps.length === 0) { let { stepZero, data } = initXY(convertToArray(premises.join('')), 0); steps.push(stepZero); + console.log(stepZero, data) this.setState({ steps: steps, data: data }); } // required to use setState to trigger re-render after creation of panzoom @@ -447,6 +450,7 @@ class Canvas extends React.Component { render() { let { proof, data, steps, currentStep, highlight, showOverlay, changeHistory } = this.state; + let { fitchStyle, setStyle } = this.props; // every time a re-render happens, ensure top-level state is up-to-date this.props.saveProof({ ...proof, data, steps, changeHistory }); // zooming function does nothing unless panzoom is initialized @@ -457,6 +461,19 @@ class Canvas extends React.Component { let tex = convertToTeX(this.state.formula); let eg = convertToEG(this.state.formula); + const swi = ( +
+ Fitch-Style Notation + + + +
+ ); + return (
-

Fitch-Style Formula to Insert

- {false && ( - { - this.setState({ fitchNotation: !this.state.fitchNotation }); - }} /> -
)} -
+

{fitchStyle && 'Fitch-Style Formula'} {!fitchStyle && 'Graph'} to Insert

+ { swi } + { fitchStyle &&
@@ -490,8 +499,8 @@ class Canvas extends React.Component {
To insert: {eg && } -
- { false &&
+
} + { !fitchStyle &&
this.setState({ formula: e.target.value, eg: e.target.value }) } />
To insert:
} diff --git a/src/converters.js b/src/converters.js index c6aac8f..2e2b72d 100644 --- a/src/converters.js +++ b/src/converters.js @@ -85,7 +85,7 @@ const wrapVarsTeX = (formula) => { let newExpr = parseExpression() str += newExpr if (newExpr === "") - str += "{}" + str += "{\u00A0}" if (!consume(')')) return null; str += ")" @@ -218,7 +218,7 @@ const convertToArray = (formula) => { else return null } -console.log(wrapVarsTeX('(((P((Q(R)))))(T))(T)P')) +console.log(wrapVarsTeX('()')) /** * Export all converters