-
+
+
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"
- }
-]