diff --git a/src/components/Compile.js b/src/components/Compile.js index 1d0f15c..a6c86c2 100644 --- a/src/components/Compile.js +++ b/src/components/Compile.js @@ -62,7 +62,7 @@ class Compile extends Component { return (
@@ -70,7 +70,7 @@ class Compile extends Component { Fehler - Etwas ist beim Compilieren schief gelaufen. Versuche es nochmal. + Etwas ist beim Kompilieren schief gelaufen. Versuche es nochmal. +
+ : null} + + + + + + + : null + ); + }; +} + +export default withRouter(withStyles(styles, {withTheme: true})(SolutionCheck)); diff --git a/src/components/Tutorial/StepperHorizontal.js b/src/components/Tutorial/StepperHorizontal.js index 510d326..6dc9dfc 100644 --- a/src/components/Tutorial/StepperHorizontal.js +++ b/src/components/Tutorial/StepperHorizontal.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { withRouter } from 'react-router-dom'; -import tutorials from './tutorials.json'; +import { tutorials } from './tutorials'; import { fade } from '@material-ui/core/styles/colorManipulator'; import { withStyles } from '@material-ui/core/styles'; diff --git a/src/components/Tutorial/StepperVertical.js b/src/components/Tutorial/StepperVertical.js index 6d25d1b..c8772a9 100644 --- a/src/components/Tutorial/StepperVertical.js +++ b/src/components/Tutorial/StepperVertical.js @@ -4,7 +4,7 @@ import { withRouter, Link } from 'react-router-dom'; import clsx from 'clsx'; -import tutorials from './tutorials.json'; +import { tutorials } from './tutorials'; import { fade } from '@material-ui/core/styles/colorManipulator'; import { withStyles } from '@material-ui/core/styles'; @@ -123,7 +123,7 @@ class StepperVertical extends Component { > {'<'} -
+
- + + diff --git a/src/components/Tutorial/TutorialHome.js b/src/components/Tutorial/TutorialHome.js index 323f5f1..7c6c1f7 100644 --- a/src/components/Tutorial/TutorialHome.js +++ b/src/components/Tutorial/TutorialHome.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import Breadcrumbs from '../Breadcrumbs'; -import tutorials from './tutorials.json'; +import { tutorials } from './tutorials'; import { Link } from 'react-router-dom'; diff --git a/src/components/Tutorial/tutorials.js b/src/components/Tutorial/tutorials.js new file mode 100644 index 0000000..988c150 --- /dev/null +++ b/src/components/Tutorial/tutorials.js @@ -0,0 +1,128 @@ +export const tutorials = [ + { + "title": "erste Schritte" + }, + { + "title": "WLAN", + "test": function(workspace){ + var wifi = workspace.getBlocksByType('sensebox_wifi'); // result is an array with Blocks as objects + if(wifi.length > 0){ + var wifiBlock = wifi[wifi.length-1] // first block is probably overwritten + if(wifiBlock.getRootBlock().type === 'sensebox_wifi'){ + return {text: 'Block, um eine WLAN-Verbindung herzustellen, ist nicht verbunden.', type: 'error'} + } + if(!wifiBlock.getFieldValue('SSID')){ + return {text: 'Die SSID-Angabe fehlt.', type: 'error'} + } + if(!wifiBlock.getFieldValue('Password')){ + return {text: 'Die Angabe des Passworts fehlt.', type: 'error'} + } + return {text: 'Super. Alles richtig!', type: 'success'} + } + else { + return {text: 'Der Block, um eine WLAN-Verbindung herzustellen, fehlt.', type: 'error'} + } + } + }, + { + "title": "spezifisches WLAN", + "test": function(workspace){ + var wifi = workspace.getBlocksByType('sensebox_wifi'); // result is an array with Blocks as objects + if(wifi.length > 0){ + var wifiBlock = wifi[wifi.length-1] // first block is probably overwritten + if(wifiBlock.getRootBlock().type === 'sensebox_wifi'){ + return {text: 'Block, um eine WLAN-Verbindung herzustellen, ist nicht verbunden.', type: 'error'} + } + var ssid = wifiBlock.getFieldValue('SSID'); + if(ssid){ + if(ssid !== 'SSID'){ + return {text: 'SSID muss als Angabe "SSID" haben.', type: 'error'} + } + } + else{ + return {text: 'Die SSID-Angabe fehlt.', type: 'error'} + } + var password = wifiBlock.getFieldValue('Password') + if(password !== 'Passwort'){ + return {text: 'Password muss als Angabe "Passwort" haben.', type: 'error'} + } + else{ + return {text: 'Die Angabe des Passworts fehlt.', type: 'error'} + } + return {text: 'Super. Alles richtig!', type: 'success'} + } + else { + return {text: 'Der Block, um eine WLAN-Verbindung herzustellen, fehlt.', type: 'error'} + } + } + }, + { + "title": "if-Bedingung" + }, + { + "title": "for-Schleife" + }, + { + "title": "erste Schritte" + }, + { + "title": "if-Bedingung" + }, + { + "title": "for-Schleife" + }, + { + "title": "erste Schritte" + }, + { + "title": "if-Bedingung" + }, + { + "title": "for-Schleife" + }, + { + "title": "erste Schritte" + }, + { + "title": "if-Bedingung" + }, + { + "title": "for-Schleife" + }, + { + "title": "erste Schritte" + }, + { + "title": "if-Bedingung" + }, + { + "title": "for-Schleife" + }, + { + "title": "erste Schritte" + }, + { + "title": "if-Bedingung" + }, + { + "title": "for-Schleife" + }, + { + "title": "erste Schritte" + }, + { + "title": "if-Bedingung" + }, + { + "title": "for-Schleife" + }, + { + "title": "erste Schritte" + }, + { + "title": "if-Bedingung" + }, + { + "title": "for-Schleife" + } +] diff --git a/src/components/Tutorial/tutorials.json b/src/components/Tutorial/tutorials.json deleted file mode 100644 index 04cf6cc..0000000 --- a/src/components/Tutorial/tutorials.json +++ /dev/null @@ -1,74 +0,0 @@ -[ - { - "title": "erste Schritte" - }, - { - "title": "if-Bedingung" - }, - { - "title": "for-Schleife" - }, - { - "title": "erste Schritte" - }, - { - "title": "if-Bedingung" - }, - { - "title": "for-Schleife" - }, - { - "title": "erste Schritte" - }, - { - "title": "if-Bedingung" - }, - { - "title": "for-Schleife" - }, - { - "title": "erste Schritte" - }, - { - "title": "if-Bedingung" - }, - { - "title": "for-Schleife" - }, - { - "title": "erste Schritte" - }, - { - "title": "if-Bedingung" - }, - { - "title": "for-Schleife" - }, - { - "title": "erste Schritte" - }, - { - "title": "if-Bedingung" - }, - { - "title": "for-Schleife" - }, - { - "title": "erste Schritte" - }, - { - "title": "if-Bedingung" - }, - { - "title": "for-Schleife" - }, - { - "title": "erste Schritte" - }, - { - "title": "if-Bedingung" - }, - { - "title": "for-Schleife" - } -]