From 595a6e0ce2a80b55a24eff0b0dd1405d6b7f1756 Mon Sep 17 00:00:00 2001 From: jackyzha0 Date: Sat, 23 May 2020 10:07:33 -0700 Subject: wip render dispatch --- frontend/src/components/PasteInfo.js | 15 +++++---------- frontend/src/components/RenderDispatch.js | 0 frontend/src/components/ViewPaste.js | 17 ++++++++++++++++- 3 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 frontend/src/components/RenderDispatch.js diff --git a/frontend/src/components/PasteInfo.js b/frontend/src/components/PasteInfo.js index 9cf4da3..9f0d3bf 100644 --- a/frontend/src/components/PasteInfo.js +++ b/frontend/src/components/PasteInfo.js @@ -37,18 +37,15 @@ const PasteInfo = (props) => { history.push(redirUrl); } - const render = () => { - } - const renderable = () => { + const buttonTxt = props.isRenderMode ? 'text' : 'render' if (props.lang === 'latex') { return ( ); } @@ -60,15 +57,13 @@ const PasteInfo = (props) => { {renderable()} diff --git a/frontend/src/components/RenderDispatch.js b/frontend/src/components/RenderDispatch.js new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/components/ViewPaste.js b/frontend/src/components/ViewPaste.js index 914f94c..00348a5 100644 --- a/frontend/src/components/ViewPaste.js +++ b/frontend/src/components/ViewPaste.js @@ -21,11 +21,13 @@ class ViewPaste extends React.Component { error: '', passError: '', theme: 'atom', + inRenderMode: false, language: LANGS.raw, }; this.handleChange = this.handleChange.bind(this); this.typedPass = this.typedPass.bind(this); + this.toggleRender = this.toggleRender.bind(this); this.validatePass = this.validatePass.bind(this); this.ErrorLabel = React.createRef(); this.PasswordModal = React.createRef(); @@ -45,6 +47,10 @@ class ViewPaste extends React.Component { this.setState({ enteredPass: event.target.value }); } + toggleRender() { + this.setState({ isRenderMode: !this.state.isRenderMode }); + } + validatePass(pass) { FetchPasswordPaste(this.props.hash, pass) .then((response) => { @@ -73,6 +79,12 @@ class ViewPaste extends React.Component { } render() { + + // var display + // if (this.state.isRenderMode) { + + // } + return (
} - expiry={this.state.expiry} /> + />
); } -- cgit v1.2.3