Skip to content

Commit

Permalink
#40 pushing latest
Browse files Browse the repository at this point in the history
  • Loading branch information
ddelpiano committed Nov 29, 2022
1 parent 1e7e8c6 commit 80eb5d8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 26 deletions.
13 changes: 3 additions & 10 deletions src/components/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ class Main extends React.Component {
metaCallback(event) {
switch (event.metaEvent) {
case EventTypes.PRE_UPDATE: {
handlePostUpdates(event, this);
break;
return handlePostUpdates(event, this);
}
case EventTypes.POST_UPDATE: {
handlePostUpdates(event, this);
break;
return handlePostUpdates(event, this);
}
default: {
throw Error('Unknown event type received from meta-diagram.');
Expand Down Expand Up @@ -115,16 +113,11 @@ class Main extends React.Component {
}
}

function mapStateToProps (state) {
return {
instanceSelected: state.selected
}
}

function mapDispatchToProps (dispatch) {
return {
selectInstance: (node) => dispatch(select(node)),
}
}

export default connect(mapStateToProps, mapDispatchToProps, null, { forwardRef : true } )(withStyles(styles)(Main));
export default connect(null, mapDispatchToProps, null)(withStyles(styles)(Main));
15 changes: 7 additions & 8 deletions src/components/graph/eventsHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,23 @@ export function handlePostUpdates(event, context) {
event?.extraCondition === CallbackTypes.CHILD_POSITION_CHANGED
);
context.interpreter.updateModel(node);
return true;
break;
}
case CallbackTypes.SELECTION_CHANGED: {
const newInstance = node.getID();
if (context.props.instanceSelected !== newInstance) {
context.props.selectInstance(newInstance);
}
context.props.selectInstance(newInstance);
break;
}
default: {
console.log(
'Function callback type not yet implemented ' + event.function
);
return false;
);
// return false;
}
}
}
return true;
}

export function handlePreUpdates(event, context) {
// console.log('preUpdates not yet implemented.');
return true;
}
14 changes: 7 additions & 7 deletions src/redux/reducers/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,27 @@ function generalReducer (state, action) {
switch (action.type) {
case Actions.OPEN_FILE: {
// TODO: to be implemented
return state;
return {...state};
}
case Actions.LOAD_MODEL: {
// TODO: to be implemented
return state;
return {...state};
}
case Actions.SAVE_MODEL: {
// TODO: to be implemented
return state;
return {...state};
}
case Actions.UPDATE_MODEL: {
// TODO: to be implemented
return state;
return {...state};
}
case Actions.SIMULATE_MODEL: {
// TODO: to be implemented
return state;
return {...state};
}
case Actions.CHANGE_VIEW: {
// TODO: to be implemented
return state;
return {...state};
}
case Actions.SELECT: {
return {
Expand All @@ -60,7 +60,7 @@ function generalReducer (state, action) {
};
}
default: {
return state;
return {...state};
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/redux/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const debounceNotify = _.debounce(notify => notify());
function initStore (state = INIT_STATE) {
return configureStore({
reducer,
middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(pnlMiddleware).concat(logger),
middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(pnlMiddleware),
devTools: process.env.NODE_ENV !== 'production',
state,
enhancers: [batchedSubscribe(debounceNotify)],
Expand Down

0 comments on commit 80eb5d8

Please sign in to comment.