import React, { Component } from "react"; import PropTypes from "prop-types"; import { connect } from "react-redux"; import { workspaceName } from "../../actions/workspaceActions"; import BlocklyWindow from "../Blockly/BlocklyWindow"; import WorkspaceFunc from "../Workspace/WorkspaceFunc"; import withWidth, { isWidthDown } from "@material-ui/core/withWidth"; import Grid from "@material-ui/core/Grid"; import Card from "@material-ui/core/Card"; import Typography from "@material-ui/core/Typography"; import * as Blockly from "blockly"; import { initialXml } from "../Blockly/initialXml"; import IconButton from "@material-ui/core/IconButton"; import CodeViewer from "../CodeViewer"; import TooltipViewer from "../TooltipViewer"; import Tooltip from "@material-ui/core/Tooltip"; import ReactMarkdown from "react-markdown"; import { faCode } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { withStyles } from "@material-ui/core/styles"; const styles = (theme) => ({ codeOn: { backgroundColor: theme.palette.primary.main, color: theme.palette.primary.contrastText, "&:hover": { backgroundColor: theme.palette.primary.contrastText, color: theme.palette.primary.main, border: `1px solid ${theme.palette.secondary.main}`, }, }, codeOff: { backgroundColor: theme.palette.primary.contrastText, color: theme.palette.primary.main, border: `1px solid ${theme.palette.secondary.main}`, "&:hover": { backgroundColor: theme.palette.primary.main, color: theme.palette.primary.contrastText, }, }, }); class Assessment extends Component { constructor(props) { super(props); this.state = { codeOn: false, }; } componentDidMount() { this.props.workspaceName(this.props.name); } componentDidUpdate(props) { if (props.name !== this.props.name) { this.props.workspaceName(this.props.name); } } onChange = () => { this.setState({ codeOn: !this.state.codeOn }); }; render() { var tutorialId = this.props.tutorial._id; var currentTask = this.props.step; var status = this.props.status.filter( (status) => status._id === tutorialId )[0]; var taskIndex = status.tasks.findIndex( (task) => task._id === currentTask._id ); var statusTask = status.tasks[taskIndex]; console.log(statusTask); return (