From 660abe97129406bc2c0d4cc4b141791bd4e52df3 Mon Sep 17 00:00:00 2001 From: Delucse <46593742+Delucse@users.noreply.github.com> Date: Sun, 20 Sep 2020 16:23:18 +0200 Subject: [PATCH] reorganize data files like tutorials.json --- src/actions/tutorialActions.js | 2 +- .../Tutorial/Builder/Requirements.js | 2 +- src/components/Tutorial/Requirement.js | 2 +- src/components/Tutorial/SolutionCheck.js | 4 +- src/components/Tutorial/StepperHorizontal.js | 2 +- src/components/Tutorial/Tutorial.js | 2 +- src/components/Tutorial/TutorialHome.js | 2 +- src/components/Tutorial/tutorials.json | 85 ------------------- src/data/tutorials.json | 85 +++++++++++++++++++ src/reducers/tutorialReducer.js | 2 +- 10 files changed, 94 insertions(+), 94 deletions(-) delete mode 100644 src/components/Tutorial/tutorials.json create mode 100644 src/data/tutorials.json diff --git a/src/actions/tutorialActions.js b/src/actions/tutorialActions.js index b741c3e..c902f70 100644 --- a/src/actions/tutorialActions.js +++ b/src/actions/tutorialActions.js @@ -1,6 +1,6 @@ import { TUTORIAL_SUCCESS, TUTORIAL_ERROR, TUTORIAL_CHANGE, TUTORIAL_XML, TUTORIAL_ID, TUTORIAL_STEP } from './types'; -import tutorials from '../components/Tutorial/tutorials.json'; +import tutorials from '../data/tutorials.json'; export const tutorialChange = () => (dispatch) => { dispatch({ diff --git a/src/components/Tutorial/Builder/Requirements.js b/src/components/Tutorial/Builder/Requirements.js index 0ccd04a..d06c62f 100644 --- a/src/components/Tutorial/Builder/Requirements.js +++ b/src/components/Tutorial/Builder/Requirements.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { changeContent } from '../../../actions/tutorialBuilderActions'; -import tutorials from '../tutorials.json'; +import tutorials from '../../../data/tutorials.json'; import FormGroup from '@material-ui/core/FormGroup'; import Checkbox from '@material-ui/core/Checkbox'; diff --git a/src/components/Tutorial/Requirement.js b/src/components/Tutorial/Requirement.js index 2d724b8..9c2542e 100644 --- a/src/components/Tutorial/Requirement.js +++ b/src/components/Tutorial/Requirement.js @@ -5,7 +5,7 @@ import { connect } from 'react-redux'; import clsx from 'clsx'; import { withRouter, Link } from 'react-router-dom'; -import tutorials from './tutorials.json'; +import tutorials from '../../data/tutorials.json'; import { fade } from '@material-ui/core/styles/colorManipulator'; import { withStyles } from '@material-ui/core/styles'; diff --git a/src/components/Tutorial/SolutionCheck.js b/src/components/Tutorial/SolutionCheck.js index 0ab7252..bc8c6c8 100644 --- a/src/components/Tutorial/SolutionCheck.js +++ b/src/components/Tutorial/SolutionCheck.js @@ -8,7 +8,7 @@ import { withRouter } from 'react-router-dom'; import Compile from '../Compile'; import Dialog from '../Dialog'; -import tutorials from './tutorials.json'; +import tutorials from '../../data/tutorials.json'; import { checkXml } from '../../helpers/compareXml'; import { withStyles } from '@material-ui/core/styles'; @@ -67,7 +67,7 @@ class SolutionCheck extends Component { - + " - }, - { - "id": 4, - "type": "instruction", - "headline": "Leuchten der LED", - "text1": "Um nun die LED zum leuchten zu bringen wird folgender Block in die Endlosschleife eingefügt. Der Block bietet dir auszuwählen an welchen Pin die LED angeschlossen wurd und ob diese ein oder ausgeschaltet werden soll.", - "xml": "" - }, - { - "id": 5, - "type": "task", - "headline": "Aufgabe 1", - "text1": "Verwenden den Block zum leuchten der LED und übertrage dein erstes Programm auf die senseBox MCU.", - "xml": "" - } - ] - }, - { - "id": 2, - "title": "WLAN einrichten", - "steps": [ - { - "id": 1, - "type": "instruction", - "headline": "Einführung", - "text1": "In diesem Tutorial lernst du wie man die senseBox mit dem Internet verbindest.", - "hardware": ["senseboxmcu", "wifi-bee"], - "requirements": [1] - }, - { - "id": 2, - "type": "instruction", - "headline": "Programmierung", - "text1": "Man benötigt folgenden Block:", - "xml": "SSIDPassword" - }, - { - "id": 3, - "type": "instruction", - "headline": "Block richtig einbinden", - "text1": "", - "xml": "SSIDPassword" - }, - { - "id": 4, - "type": "task", - "headline": "Aufgabe 1", - "text1": "Stelle eine WLAN-Verbindung mit einem beliebigen Netzwerk her.", - "xml": "SSIDPassword" - }, - { - "id": 5, - "type": "task", - "headline": "Aufgabe 2", - "text1": "Versuche das gleiche einfach nochmal. Übung macht den Meister! ;)", - "xml": "SSIDPassword" - } - ] - } -] diff --git a/src/data/tutorials.json b/src/data/tutorials.json new file mode 100644 index 0000000..1c4bf2c --- /dev/null +++ b/src/data/tutorials.json @@ -0,0 +1,85 @@ +[ + { + "id":1, + "title":"Erste Schritte", + "steps":[ + { + "id":1, + "type":"instruction", + "headline":"Erste Schritte", + "text":"In diesem Tutorial lernst du die ersten Schritte mit der senseBox kennen. Du erstellst ein erstes Programm, baust einen ersten Schaltkreis auf und lernst, wie du das Programm auf die senseBox MCU überträgst.", + "hardware":["senseboxmcu","led","breadboard","jst-adapter","resistor-470ohm"], + "requirements":[] + }, + { + "id":2, + "type":"instruction", + "headline":"Aufbau der Schaltung", + "text":"Stecke die LED auf das Breadboard und verbinde diese mithile des Widerstandes und dem JST Kabel mit dem Port Digital/Analog 1." + }, + { + "id":3, + "type":"instruction", + "headline":"Programmierung", + "text":"Jedes Programm für die senseBox besteht aus zwei Funktionen. Die Setup () Funktion wird zu Begin einmalig ausgeführt und der Programmcode Schrittweise ausgeführt. Nachdem die Setup () Funktion durchlaufen worden ist wird der Programmcode aus der zweiten Funktion, der Endlosschleife, fortlaufend wiederholt.", + "xml":"" + }, + { + "id":4, + "type":"instruction", + "headline":"Leuchten der LED", + "text":"Um nun die LED zum leuchten zu bringen wird folgender Block in die Endlosschleife eingefügt. Der Block bietet dir auszuwählen an welchen Pin die LED angeschlossen wurd und ob diese ein oder ausgeschaltet werden soll.", + "xml":"" + }, + { + "id":5, + "type":"task", + "headline":"Aufgabe 1", + "text":"Verwenden den Block zum leuchten der LED und übertrage dein erstes Programm auf die senseBox MCU.", + "xml":"" + } + ] + }, + { + "id": 2, + "title": "WLAN einrichten", + "steps": [ + { + "id": 1, + "type": "instruction", + "headline": "Einführung", + "text1": "In diesem Tutorial lernst du wie man die senseBox mit dem Internet verbindest.", + "hardware": ["senseboxmcu", "wifi-bee"], + "requirements": [1] + }, + { + "id": 2, + "type": "instruction", + "headline": "Programmierung", + "text1": "Man benötigt folgenden Block:", + "xml": "SSIDPassword" + }, + { + "id": 3, + "type": "instruction", + "headline": "Block richtig einbinden", + "text1": "", + "xml": "SSIDPassword" + }, + { + "id": 4, + "type": "task", + "headline": "Aufgabe 1", + "text1": "Stelle eine WLAN-Verbindung mit einem beliebigen Netzwerk her.", + "xml": "SSIDPassword" + }, + { + "id": 5, + "type": "task", + "headline": "Aufgabe 2", + "text1": "Versuche das gleiche einfach nochmal. Übung macht den Meister! ;)", + "xml": "SSIDPassword" + } + ] + } +] diff --git a/src/reducers/tutorialReducer.js b/src/reducers/tutorialReducer.js index ad80903..66361ba 100644 --- a/src/reducers/tutorialReducer.js +++ b/src/reducers/tutorialReducer.js @@ -1,6 +1,6 @@ import { TUTORIAL_SUCCESS, TUTORIAL_ERROR, TUTORIAL_CHANGE, TUTORIAL_XML, TUTORIAL_ID, TUTORIAL_STEP } from '../actions/types'; -import tutorials from '../components/Tutorial/tutorials.json'; +import tutorials from '../data/tutorials.json'; const initialStatus = () => { if(window.localStorage.getItem('status')){