diff --git a/src/actions/tutorialActions.js b/src/actions/tutorialActions.js index edf070c..147c97b 100644 --- a/src/actions/tutorialActions.js +++ b/src/actions/tutorialActions.js @@ -1,4 +1,4 @@ -import { TUTORIAL_SUCCESS, TUTORIAL_ERROR, TUTORIAL_CHANGE, TUTORIAL_XML, TUTORIAL_ID, TUTORIAL_LEVEL } from './types'; +import { TUTORIAL_SUCCESS, TUTORIAL_ERROR, TUTORIAL_CHANGE, TUTORIAL_XML, TUTORIAL_ID, TUTORIAL_STEP } from './types'; export const tutorialChange = () => (dispatch) => { dispatch({ @@ -30,13 +30,6 @@ export const storeTutorialXml = (code) => (dispatch, getState) => { } }; -// level = "instruction" or "assessment" -export const setTutorialLevel = (level) => (dispatch) => { - dispatch({ - type: TUTORIAL_LEVEL, - payload: level - }); -} export const tutorialId = (id) => (dispatch) => { dispatch({ @@ -44,3 +37,10 @@ export const tutorialId = (id) => (dispatch) => { payload: id }); }; + +export const tutorialStep = (step) => (dispatch) => { + dispatch({ + type: TUTORIAL_STEP, + payload: step + }); +}; diff --git a/src/actions/types.js b/src/actions/types.js index 9d26386..27bd18d 100644 --- a/src/actions/types.js +++ b/src/actions/types.js @@ -12,4 +12,4 @@ export const TUTORIAL_ERROR = 'TUTORIAL_ERROR'; export const TUTORIAL_CHANGE = 'TUTORIAL_CHANGE'; export const TUTORIAL_XML = 'TUTORIAL_XML'; export const TUTORIAL_ID = 'TUTORIAL_ID'; -export const TUTORIAL_LEVEL = 'TUTORIAL_LEVEL'; +export const TUTORIAL_STEP = 'TUTORIAL_STEP'; diff --git a/src/components/Blockly/BlocklyWindow.js b/src/components/Blockly/BlocklyWindow.js index 93a0633..1ee6baa 100644 --- a/src/components/Blockly/BlocklyWindow.js +++ b/src/components/Blockly/BlocklyWindow.js @@ -26,16 +26,18 @@ class BlocklyWindow extends Component { this.props.onChangeWorkspace(event); Blockly.Events.disableOrphans(event); }); + Blockly.svgResize(workspace); } - componentDidUpdate(props) { - if(props.initialXml !== this.props.initialXml){ - // guarantees that the current xml-code (this.props.initialXml) is rendered - const workspace = Blockly.getMainWorkspace(); - workspace.clear(); - Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(this.props.initialXml), workspace); - } - } + // componentDidUpdate(props) { + // const workspace = Blockly.getMainWorkspace(); + // if(props.initialXml !== this.props.initialXml){ + // // guarantees that the current xml-code (this.props.initialXml) is rendered + // workspace.clear(); + // Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(this.props.initialXml), workspace); + // } + // Blockly.svgResize(workspace); + // } render() { return ( diff --git a/src/components/Tutorial/Assessment.js b/src/components/Tutorial/Assessment.js new file mode 100644 index 0000000..be6fe8b --- /dev/null +++ b/src/components/Tutorial/Assessment.js @@ -0,0 +1,53 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { connect } from 'react-redux'; + +import BlocklyWindow from '../Blockly/BlocklyWindow'; +import SolutionCheck from './SolutionCheck'; +import CodeViewer from '../CodeViewer'; + +import Grid from '@material-ui/core/Grid'; +import Card from '@material-ui/core/Card'; +import Typography from '@material-ui/core/Typography'; + +class Assessment extends Component { + + render() { + var currentTutorialId = this.props.currentTutorialId; + var step = this.props.step + return ( +
{tutorials[currentTutorialId].instruction.description}
- {tutorials[currentTutorialId].instruction.xml ? -