Merge branch 'assessment' into backend-connection
This commit is contained in:
		
						commit
						2e330d1215
					
				| @ -18,13 +18,14 @@ export const getTutorial = (id) => (dispatch, getState) => { | |||||||
|           type: GET_TUTORIAL, |           type: GET_TUTORIAL, | ||||||
|           payload: tutorial |           payload: tutorial | ||||||
|         }); |         }); | ||||||
|  |         dispatch(returnSuccess(res.data.message, res.status)); | ||||||
|       }); |       }); | ||||||
|     }) |     }) | ||||||
|     .catch(err => { |     .catch(err => { | ||||||
|       dispatch({type: TUTORIAL_PROGRESS}); |  | ||||||
|       if(err.response){ |       if(err.response){ | ||||||
|         dispatch(returnErrors(err.response.data.message, err.response.status, 'GET_TUTORIAL_FAIL')); |         dispatch(returnErrors(err.response.data.message, err.response.status, 'GET_TUTORIAL_FAIL')); | ||||||
|       } |       } | ||||||
|  |       dispatch({type: TUTORIAL_PROGRESS}); | ||||||
|     }); |     }); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| @ -44,13 +45,14 @@ export const getTutorials = () => (dispatch, getState) => { | |||||||
|           payload: tutorials |           payload: tutorials | ||||||
|         }); |         }); | ||||||
|         dispatch({type: TUTORIAL_PROGRESS}); |         dispatch({type: TUTORIAL_PROGRESS}); | ||||||
|  |         dispatch(returnSuccess(res.data.message, res.status)); | ||||||
|       }); |       }); | ||||||
|     }) |     }) | ||||||
|     .catch(err => { |     .catch(err => { | ||||||
|       dispatch({type: TUTORIAL_PROGRESS}); |  | ||||||
|       if(err.response){ |       if(err.response){ | ||||||
|         dispatch(returnErrors(err.response.data.message, err.response.status, 'GET_TUTORIALS_FAIL')); |         dispatch(returnErrors(err.response.data.message, err.response.status, 'GET_TUTORIALS_FAIL')); | ||||||
|       } |       } | ||||||
|  |       dispatch({type: TUTORIAL_PROGRESS}); | ||||||
|     }); |     }); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -34,7 +34,7 @@ class Assessment extends Component { | |||||||
|     return ( |     return ( | ||||||
|       <div style={{ width: '100%' }}> |       <div style={{ width: '100%' }}> | ||||||
|         <Typography variant='h4' style={{ float: 'left', marginBottom: '5px', height: '40px', display: 'table' }}>{currentTask.headline}</Typography> |         <Typography variant='h4' style={{ float: 'left', marginBottom: '5px', height: '40px', display: 'table' }}>{currentTask.headline}</Typography> | ||||||
|         <div style={{ float: 'right', height: '40px' }}><WorkspaceFunc solutionCheck /></div> |         <div style={{ float: 'right', height: '40px' }}><WorkspaceFunc assessment /></div> | ||||||
|         <Grid container spacing={2} style={{ marginBottom: '5px' }}> |         <Grid container spacing={2} style={{ marginBottom: '5px' }}> | ||||||
|           <Grid item xs={12} md={6} lg={8}> |           <Grid item xs={12} md={6} lg={8}> | ||||||
|             <BlocklyWindow |             <BlocklyWindow | ||||||
|  | |||||||
| @ -22,17 +22,14 @@ class Tutorial extends Component { | |||||||
| 
 | 
 | ||||||
|   componentDidMount() { |   componentDidMount() { | ||||||
|     this.props.getTutorial(this.props.match.params.tutorialId); |     this.props.getTutorial(this.props.match.params.tutorialId); | ||||||
|     // this.props.tutorialId(Number(this.props.match.params.tutorialId));
 |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   componentDidUpdate(props, state) { |   componentDidUpdate(props, state) { | ||||||
|     if(this.props.tutorial && !this.props.isLoading && this.props.tutorial._id != this.props.match.params.tutorialId) { |     if(this.props.tutorial && !this.props.isLoading && this.props.tutorial._id != this.props.match.params.tutorialId) { | ||||||
|       this.props.getTutorial(this.props.match.params.tutorialId); |       this.props.getTutorial(this.props.match.params.tutorialId); | ||||||
|       // this.props.tutorialId(Number(this.props.match.params.tutorialId));
 |  | ||||||
|     } |     } | ||||||
|     if(this.props.message.id === 'GET_TUTORIAL_FAIL'){ |     if(this.props.message.id === 'GET_TUTORIAL_FAIL'){ | ||||||
|       alert(this.props.message.msg); |       alert(this.props.message.msg); | ||||||
|       this.props.clearMessages(); |  | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| @ -48,7 +45,8 @@ class Tutorial extends Component { | |||||||
|     return ( |     return ( | ||||||
|       <div> |       <div> | ||||||
|         {this.props.isLoading ? null : |         {this.props.isLoading ? null : | ||||||
|           !this.props.tutorial ? <NotFound button={{ title: 'Zurück zur Tutorials-Übersicht', link: '/tutorial' }} /> |           !this.props.tutorial ? | ||||||
|  |             this.props.message.id === 'GET_TUTORIAL_FAIL' ? <NotFound button={{ title: 'Zurück zur Tutorials-Übersicht', link: '/tutorial' }} /> : null | ||||||
|             : (() => { |             : (() => { | ||||||
|                 var tutorial = this.props.tutorial; |                 var tutorial = this.props.tutorial; | ||||||
|                 var steps = this.props.tutorial.steps; |                 var steps = this.props.tutorial.steps; | ||||||
|  | |||||||
| @ -58,7 +58,6 @@ class TutorialHome extends Component { | |||||||
|   componentDidUpdate(props, state) { |   componentDidUpdate(props, state) { | ||||||
|     if(this.props.message.id === 'GET_TUTORIALS_FAIL'){ |     if(this.props.message.id === 'GET_TUTORIALS_FAIL'){ | ||||||
|       alert(this.props.message.msg); |       alert(this.props.message.msg); | ||||||
|       this.props.clearMessages(); |  | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -208,7 +208,7 @@ class WorkspaceFunc extends Component { | |||||||
|             this.setState({ open: true, file: false, title: 'Keine Blöcke', content: 'Es wurden keine Blöcke detektiert. Bitte überprüfe den XML-Code und versuche es erneut.' }); |             this.setState({ open: true, file: false, title: 'Keine Blöcke', content: 'Es wurden keine Blöcke detektiert. Bitte überprüfe den XML-Code und versuche es erneut.' }); | ||||||
|           } |           } | ||||||
|           else { |           else { | ||||||
|             if (!this.props.solutionCheck) { |             if (!this.props.assessment) { | ||||||
|               var extensionPosition = xmlFile.name.lastIndexOf('.'); |               var extensionPosition = xmlFile.name.lastIndexOf('.'); | ||||||
|               this.props.workspaceName(xmlFile.name.substr(0, extensionPosition)); |               this.props.workspaceName(xmlFile.name.substr(0, extensionPosition)); | ||||||
|             } |             } | ||||||
| @ -237,7 +237,7 @@ class WorkspaceFunc extends Component { | |||||||
|     workspace.options.maxBlocks = Infinity; |     workspace.options.maxBlocks = Infinity; | ||||||
|     this.props.onChangeCode(); |     this.props.onChangeCode(); | ||||||
|     this.props.clearStats(); |     this.props.clearStats(); | ||||||
|     if (!this.props.solutionCheck) { |     if (!this.props.assessment) { | ||||||
|       this.props.workspaceName(null); |       this.props.workspaceName(null); | ||||||
|     } |     } | ||||||
|     this.setState({ snackbar: true, type: 'success', key: Date.now(), message: 'Das Projekt wurde erfolgreich zurückgesetzt.' }); |     this.setState({ snackbar: true, type: 'success', key: Date.now(), message: 'Das Projekt wurde erfolgreich zurückgesetzt.' }); | ||||||
| @ -248,7 +248,7 @@ class WorkspaceFunc extends Component { | |||||||
|   render() { |   render() { | ||||||
|     return ( |     return ( | ||||||
|       <div style={{ width: 'max-content', display: 'flex' }}> |       <div style={{ width: 'max-content', display: 'flex' }}> | ||||||
|         {!this.props.solutionCheck ? |         {!this.props.assessment ? | ||||||
|           <Tooltip title={`Name des Projekts${this.props.name ? `: ${this.props.name}` : ''}`} arrow style={{ marginRight: '5px' }}> |           <Tooltip title={`Name des Projekts${this.props.name ? `: ${this.props.name}` : ''}`} arrow style={{ marginRight: '5px' }}> | ||||||
|             <div className={this.props.classes.workspaceName} onClick={() => { this.setState({ file: true, open: true, saveFile: false, title: 'Projekt benennen', content: 'Bitte gib einen Namen für das Projekt ein und bestätige diesen mit einem Klick auf \'Eingabe\'.' }) }}> |             <div className={this.props.classes.workspaceName} onClick={() => { this.setState({ file: true, open: true, saveFile: false, title: 'Projekt benennen', content: 'Bitte gib einen Namen für das Projekt ein und bestätige diesen mit einem Klick auf \'Eingabe\'.' }) }}> | ||||||
|               {this.props.name && !isWidthDown('xs', this.props.width) ? <Typography style={{ margin: 'auto -3px auto 12px' }}>{this.props.name}</Typography> : null} |               {this.props.name && !isWidthDown('xs', this.props.width) ? <Typography style={{ margin: 'auto -3px auto 12px' }}>{this.props.name}</Typography> : null} | ||||||
| @ -258,7 +258,7 @@ class WorkspaceFunc extends Component { | |||||||
|             </div> |             </div> | ||||||
|           </Tooltip> |           </Tooltip> | ||||||
|           : null} |           : null} | ||||||
|         {this.props.solutionCheck ? <SolutionCheck /> : <Compile iconButton />} |         {this.props.assessment ? <SolutionCheck /> : <Compile iconButton />} | ||||||
|         <Tooltip title='Blöcke speichern' arrow style={{ marginRight: '5px' }}> |         <Tooltip title='Blöcke speichern' arrow style={{ marginRight: '5px' }}> | ||||||
|           <IconButton |           <IconButton | ||||||
|             className={this.props.classes.button} |             className={this.props.classes.button} | ||||||
| @ -267,6 +267,7 @@ class WorkspaceFunc extends Component { | |||||||
|             <FontAwesomeIcon icon={faSave} size="xs" /> |             <FontAwesomeIcon icon={faSave} size="xs" /> | ||||||
|           </IconButton> |           </IconButton> | ||||||
|         </Tooltip> |         </Tooltip> | ||||||
|  |         {!this.props.assessment? | ||||||
|           <div ref={this.inputRef} style={{ width: 'max-content', height: '40px', marginRight: '5px' }}> |           <div ref={this.inputRef} style={{ width: 'max-content', height: '40px', marginRight: '5px' }}> | ||||||
|             <input |             <input | ||||||
|               style={{ display: 'none' }} |               style={{ display: 'none' }} | ||||||
| @ -287,6 +288,8 @@ class WorkspaceFunc extends Component { | |||||||
|               </Tooltip> |               </Tooltip> | ||||||
|             </label> |             </label> | ||||||
|           </div> |           </div> | ||||||
|  |         : null} | ||||||
|  |         {!this.props.assessment? | ||||||
|           <Tooltip title='Screenshot erstellen' arrow style={{ marginRight: '5px' }}> |           <Tooltip title='Screenshot erstellen' arrow style={{ marginRight: '5px' }}> | ||||||
|             <IconButton |             <IconButton | ||||||
|               className={this.props.classes.button} |               className={this.props.classes.button} | ||||||
| @ -295,6 +298,7 @@ class WorkspaceFunc extends Component { | |||||||
|               <FontAwesomeIcon icon={faCamera} size="xs" /> |               <FontAwesomeIcon icon={faCamera} size="xs" /> | ||||||
|             </IconButton> |             </IconButton> | ||||||
|           </Tooltip> |           </Tooltip> | ||||||
|  |         : null} | ||||||
|         <Tooltip title='Workspace zurücksetzen' arrow style={{ marginRight: '5px' }}> |         <Tooltip title='Workspace zurücksetzen' arrow style={{ marginRight: '5px' }}> | ||||||
|           <IconButton |           <IconButton | ||||||
|             className={this.props.classes.button} |             className={this.props.classes.button} | ||||||
| @ -303,6 +307,7 @@ class WorkspaceFunc extends Component { | |||||||
|             <FontAwesomeIcon icon={faShare} size="xs" flip='horizontal' /> |             <FontAwesomeIcon icon={faShare} size="xs" flip='horizontal' /> | ||||||
|           </IconButton> |           </IconButton> | ||||||
|         </Tooltip> |         </Tooltip> | ||||||
|  |         {!this.props.assessment? | ||||||
|           <Tooltip title='Blöcke teilen' arrow> |           <Tooltip title='Blöcke teilen' arrow> | ||||||
|             <IconButton |             <IconButton | ||||||
|               className={this.props.classes.button} |               className={this.props.classes.button} | ||||||
| @ -311,6 +316,7 @@ class WorkspaceFunc extends Component { | |||||||
|               <FontAwesomeIcon icon={faShareAlt} size="xs" flip='horizontal' /> |               <FontAwesomeIcon icon={faShareAlt} size="xs" flip='horizontal' /> | ||||||
|             </IconButton> |             </IconButton> | ||||||
|           </Tooltip> |           </Tooltip> | ||||||
|  |         :null} | ||||||
| 
 | 
 | ||||||
|         <Dialog |         <Dialog | ||||||
|           open={this.state.open} |           open={this.state.open} | ||||||
|  | |||||||
| @ -1,11 +1,11 @@ | |||||||
| let tutorials = [ | // let tutorials = [
 | ||||||
|     require('./tutorial/ErsteSchritte.json'), | //     require('./tutorial/ErsteSchritte.json'),
 | ||||||
|     require('./tutorial/Schleifen.json'), | //     require('./tutorial/Schleifen.json'),
 | ||||||
|     require('./tutorial/Wenn-DannBedingungen.json'), | //     require('./tutorial/Wenn-DannBedingungen.json'),
 | ||||||
|     require('./tutorial/VerwendungVonVariablen.json'), | //     require('./tutorial/VerwendungVonVariablen.json'),
 | ||||||
|     require('./tutorial/SendenVonMesswertenUeberLoRa.json'), | //     require('./tutorial/SendenVonMesswertenUeberLoRa.json'),
 | ||||||
|     require('./tutorial/AnzeigeVonMesswertenAufDemDisplay.json'), | //     require('./tutorial/AnzeigeVonMesswertenAufDemDisplay.json'),
 | ||||||
|     require('./tutorial/MesswerteAnDieOpenSenseMapSenden.json') | //     require('./tutorial/MesswerteAnDieOpenSenseMapSenden.json')
 | ||||||
| ] | // ]
 | ||||||
| 
 | //
 | ||||||
| module.exports = tutorials; | // module.exports = tutorials;
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user