first Blockly functionalities

Attention: the buttons currently trigger an error
This commit is contained in:
Delucse
2020-07-23 11:33:13 +02:00
parent 857da78c49
commit c05572a68e
15 changed files with 766 additions and 25 deletions
+6
View File
@@ -0,0 +1,6 @@
import { combineReducers } from 'redux';
import workspaceReducer from './workspaceReducer';
export default combineReducers({
workspace: workspaceReducer
});
+35
View File
@@ -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;
}
}