first Blockly functionalities
Attention: the buttons currently trigger an error
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import { combineReducers } from 'redux';
|
||||
import workspaceReducer from './workspaceReducer';
|
||||
|
||||
export default combineReducers({
|
||||
workspace: workspaceReducer
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
import { NEW_WORKSPACE, CREATE_BLOCK, CHANGE_BLOCK, DELETE_BLOCK, CLEAR_STATS } from '../actions/types';
|
||||
|
||||
|
||||
const initialState = {
|
||||
old: {},
|
||||
new: {},
|
||||
stats: {
|
||||
create: 0,
|
||||
change: 0,
|
||||
delete: 0,
|
||||
},
|
||||
test: 0
|
||||
};
|
||||
|
||||
export default function(state = initialState, action){
|
||||
switch(action.type){
|
||||
case NEW_WORKSPACE:
|
||||
return {
|
||||
...state,
|
||||
old: action.payload.old,
|
||||
new: action.payload.new,
|
||||
test: state.test += 1
|
||||
};
|
||||
case CREATE_BLOCK:
|
||||
case CHANGE_BLOCK:
|
||||
case DELETE_BLOCK:
|
||||
case CLEAR_STATS:
|
||||
return {
|
||||
...state,
|
||||
stats: action.payload
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user