adaptation of the functionalities to Blockly package

This commit is contained in:
Delucse
2020-07-23 15:42:01 +02:00
parent d1d7a447bc
commit c2405de04a
11 changed files with 254 additions and 73 deletions
+20 -7
View File
@@ -1,27 +1,40 @@
import { NEW_WORKSPACE, CREATE_BLOCK, CHANGE_BLOCK, DELETE_BLOCK, CLEAR_STATS } from '../actions/types';
import { CHANGE_WORKSPACE, NEW_CODE, NEW_WORKSPACE, CREATE_BLOCK, MOVE_BLOCK, CHANGE_BLOCK, DELETE_BLOCK, CLEAR_STATS } from '../actions/types';
const initialState = {
old: {},
new: {},
code: {
arduino: '',
xml: ''
},
workspace: null,
stats: {
create: 0,
change: 0,
delete: 0,
move: 0
},
test: 0
change: 0
};
export default function(state = initialState, action){
switch(action.type){
case NEW_CODE:
return {
...state,
code: action.payload
};
case CHANGE_WORKSPACE:
return {
...state,
change: state.change += 1
};
case NEW_WORKSPACE:
return {
...state,
old: action.payload.old,
new: action.payload.new,
test: state.test += 1
workspace: action.payload
};
case CREATE_BLOCK:
case MOVE_BLOCK:
case CHANGE_BLOCK:
case DELETE_BLOCK:
case CLEAR_STATS: