adaptation of the functionalities to Blockly package
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user