{tutorialIds.map((tutorialId, i) => {
- var title = tutorials.filter(tutorial => tutorial.id === tutorialId)[0].title;
+ // title must be provided together with ids
+ // var title = tutorials.filter(tutorial => tutorial.id === tutorialId)[0].title;
var status = this.props.status.filter(status => status.id === tutorialId)[0];
var tasks = status.tasks;
var error = status.tasks.filter(task => task.type === 'error').length > 0;
@@ -99,7 +98,7 @@ class Requirement extends Component {
- {title}
+ {/*title*/}Name hinzufügen über Datenbankeintrag
)
diff --git a/src/components/Tutorial/StepperHorizontal.js b/src/components/Tutorial/StepperHorizontal.js
index 89b7ccd..acfccca 100644
--- a/src/components/Tutorial/StepperHorizontal.js
+++ b/src/components/Tutorial/StepperHorizontal.js
@@ -6,7 +6,7 @@ import { withRouter } from 'react-router-dom';
import clsx from 'clsx';
-import tutorials from '../../data/tutorials';
+// import tutorials from '../../data/tutorials';
import { fade } from '@material-ui/core/styles/colorManipulator';
import { withStyles } from '@material-ui/core/styles';
@@ -70,8 +70,8 @@ class StepperHorizontal extends Component {
: null}
@@ -82,8 +82,8 @@ class StepperHorizontal extends Component {
diff --git a/src/reducers/tutorialReducer.js b/src/reducers/tutorialReducer.js
index eb7350e..8b91f0f 100644
--- a/src/reducers/tutorialReducer.js
+++ b/src/reducers/tutorialReducer.js
@@ -1,46 +1,18 @@
import { TUTORIAL_PROGRESS, GET_TUTORIAL, GET_TUTORIALS, TUTORIAL_SUCCESS, TUTORIAL_ERROR, TUTORIAL_CHANGE, TUTORIAL_XML, TUTORIAL_ID, TUTORIAL_STEP } from '../actions/types';
-import tutorials from '../data/tutorials';
const initialStatus = () => {
if (window.localStorage.getItem('status')) {
var status = JSON.parse(window.localStorage.getItem('status'));
- var existingTutorialIds = tutorials.map((tutorial, i) => {
- var tutorialsId = tutorial.id;
- var statusIndex = status.findIndex(status => status.id === tutorialsId);
- if (statusIndex > -1) {
- var tasks = tutorial.steps.filter(step => step.type === 'task');
- var existingTaskIds = tasks.map((task, j) => {
- var tasksId = task.id;
- if (status[statusIndex].tasks.findIndex(task => task.id === tasksId) === -1) {
- // task does not exist
- status[statusIndex].tasks.push({ id: tasksId });
- }
- return tasksId;
- });
- // deleting old tasks which do not longer exist
- if (existingTaskIds.length > 0) {
- status[statusIndex].tasks = status[statusIndex].tasks.filter(task => existingTaskIds.indexOf(task.id) > -1);
- }
- }
- else {
- status.push({ id: tutorialsId, tasks: tutorial.steps.filter(step => step.type === 'task').map(task => { return { id: task.id }; }) });
- }
- return tutorialsId;
- });
- // deleting old tutorials which do not longer exist
- if (existingTutorialIds.length > 0) {
- status = status.filter(status => existingTutorialIds.indexOf(status.id) > -1);
- }
return status;
}
- // window.localStorage.getItem('status') does not exist
- return tutorials.map(tutorial => { return { id: tutorial.id, tasks: tutorial.steps.filter(step => step.type === 'task').map(task => { return { id: task.id }; }) }; });
+ return [];
+ // // window.localStorage.getItem('status') does not exist
+ // return tutorials.map(tutorial => { return { id: tutorial.id, tasks: tutorial.steps.filter(step => step.type === 'task').map(task => { return { id: task.id }; }) }; });
};
const initialState = {
status: initialStatus(),
- currentIndex: null,
activeStep: 0,
change: 0,
tutorials: [],
@@ -78,11 +50,6 @@ export default function (state = initialState, action) {
...state,
change: state.change += 1
}
- case TUTORIAL_ID:
- return {
- ...state,
- currentIndex: tutorials.findIndex(tutorial => tutorial.id === action.payload)
- }
case TUTORIAL_STEP:
return {
...state,