generate JSON-file
This commit is contained in:
@@ -4,7 +4,6 @@ import { connect } from 'react-redux';
|
||||
import { workspaceName } from '../../actions/workspaceActions';
|
||||
|
||||
import BlocklyWindow from '../Blockly/BlocklyWindow';
|
||||
import SolutionCheck from './SolutionCheck';
|
||||
import CodeViewer from '../CodeViewer';
|
||||
import WorkspaceFunc from '../WorkspaceFunc';
|
||||
|
||||
@@ -45,7 +44,7 @@ class Assessment extends Component {
|
||||
<Grid item xs={12} md={6} lg={4} style={isWidthDown('sm', this.props.width) ? {height: 'max-content'} : {}}>
|
||||
<Card style={{height: 'calc(50% - 30px)', padding: '10px', marginBottom: '10px'}}>
|
||||
<Typography variant='h5'>Arbeitsauftrag</Typography>
|
||||
<Typography>{currentTask.text1}</Typography>
|
||||
<Typography>{currentTask.text}</Typography>
|
||||
</Card>
|
||||
<div style={isWidthDown('sm', this.props.width) ? {height: '500px'} : {height: '50%'}}>
|
||||
<CodeViewer />
|
||||
|
||||
@@ -3,6 +3,10 @@ import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { checkError } from '../../../actions/tutorialBuilderActions';
|
||||
|
||||
import { saveAs } from 'file-saver';
|
||||
|
||||
import { detectWhitespacesAndReturnReadableResult } from '../../../helpers/whitespace';
|
||||
|
||||
import Breadcrumbs from '../../Breadcrumbs';
|
||||
import Id from './Id';
|
||||
import Title from './Textfield';
|
||||
@@ -12,6 +16,22 @@ import Button from '@material-ui/core/Button';
|
||||
|
||||
class Builder extends Component {
|
||||
|
||||
submit = () => {
|
||||
var isError = this.props.checkError();
|
||||
if(isError){
|
||||
alert('Error');
|
||||
}
|
||||
else{
|
||||
var tutorial = {
|
||||
id: this.props.id,
|
||||
title: this.props.title,
|
||||
steps: this.props.steps
|
||||
}
|
||||
var blob = new Blob([JSON.stringify(tutorial)], { type: 'text/json' });
|
||||
saveAs(blob, `${detectWhitespacesAndReturnReadableResult(tutorial.title)}.json`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
return (
|
||||
@@ -29,7 +49,7 @@ class Builder extends Component {
|
||||
)}
|
||||
|
||||
|
||||
<Button variant='contained' color='primary' onClick={() => {var error = this.props.checkError(); alert(error);}}>Tutorial-Vorlage erstellen</Button>
|
||||
<Button variant='contained' color='primary' onClick={() => this.submit()}>Tutorial-Vorlage erstellen</Button>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@@ -18,7 +18,7 @@ class Instruction extends Component {
|
||||
return (
|
||||
<div>
|
||||
<Typography variant='h4' style={{marginBottom: '5px'}}>{step.headline}</Typography>
|
||||
<Typography style={isHardware ? {} : {marginBottom: '5px'}}>{step.text1}</Typography>
|
||||
<Typography style={isHardware ? {} : {marginBottom: '5px'}}>{step.text}</Typography>
|
||||
{isHardware ?
|
||||
<Hardware picture={step.hardware}/> : null}
|
||||
{areRequirements > 0 ?
|
||||
|
||||
Reference in New Issue
Block a user