Skip to content

Commit

Permalink
Move code control info text to messageblock
Browse files Browse the repository at this point in the history
  • Loading branch information
ttu committed May 2, 2019
1 parent ae100a5 commit cf867b9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/components/CodeControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ interface IState {
executionError: string;
}

const INFO_TEXT = `// Insert the code inside the async function (starting from line 9).
// Press the Execute button to run the code.`;
const INFO_TEXT = `Insert the code inside the async function (starting from line 6). Press the Execute button to run the code.`;

const TEMPLATE = `${INFO_TEXT}
import LegoBoost from 'lego-boost-browser';
const TEMPLATE = `import LegoBoost from 'lego-boost-browser';
const boost = new LegoBoost();
Expand Down Expand Up @@ -62,7 +59,9 @@ class CodeControl extends React.Component<IProps, IState> {
}

componentWillUnmount = () => {
this.props.updateCode(this.state.codeToRun);
if (this.props.code !== this.state.codeToRun) {
this.props.updateCode(this.state.codeToRun);
}
};

handleItemClick = (e, { name }) => {
Expand Down Expand Up @@ -100,7 +99,7 @@ class CodeControl extends React.Component<IProps, IState> {
editorDidMount = (editor: monacoEditor.editor.IStandaloneCodeEditor, monaco) => {
editor.focus();
editor.onDidChangeCursorSelection(e => {
const readOnly = e.selection.startLineNumber <= 8;
const readOnly = e.selection.startLineNumber <= 5;
editor.updateOptions({ readOnly });
});
editor.onKeyDown(e => {
Expand All @@ -116,8 +115,9 @@ class CodeControl extends React.Component<IProps, IState> {
render() {
return (
<Container>
{/* TODO: Figue out why closing this trigger componentWillUnmount multiple times */}
{/* <MessageBlock visible={this.props.infoVisible} onClose={this.props.onInfoClose} content={INFO_TEXT} /> */}
<Container style={{'paddingBottom':'20px'}}>
<MessageBlock visible={this.props.infoVisible} infoToggle={this.props.infoToggle} content={INFO_TEXT} />
</Container>

<Container textAlign="left">
<MonacoEditor
Expand Down

0 comments on commit cf867b9

Please sign in to comment.