diff --git a/src/lib/vm-listener-hoc.jsx b/src/lib/vm-listener-hoc.jsx index 4359e986559a833c4a93108c68bf9fb00dd8173f..97b6a637b4ff39615885533bd8a9b8b7260607fe 100644 --- a/src/lib/vm-listener-hoc.jsx +++ b/src/lib/vm-listener-hoc.jsx @@ -139,7 +139,9 @@ const vmListenerHOC = function (WrappedComponent) { onProjectRunStop: () => dispatch(setRunningState(false)), onTurboModeOn: () => dispatch(setTurboState(true)), onTurboModeOff: () => dispatch(setTurboState(false)), - onShowAlert: () => dispatch(showAlert()) + onShowAlert: data => { + dispatch(showAlert(data.message)); + } }); return connect( mapStateToProps, diff --git a/src/reducers/alerts.js b/src/reducers/alerts.js index 7442394e774594a1dab5eb4d87aa098a832e4d6b..74e488829766498473a256796cca6429bcbfb421 100644 --- a/src/reducers/alerts.js +++ b/src/reducers/alerts.js @@ -2,7 +2,7 @@ const CLOSE_ALERT = 'scratch-gui/alerts/CLOSE_ALERT'; const SHOW_ALERT = 'scratch-gui/alerts/SHOW_ALERT'; const initialState = { - message: 'Peripheral error', + message: 'Alert', visible: false }; @@ -11,7 +11,8 @@ const reducer = function (state, action) { switch (action.type) { case SHOW_ALERT: return Object.assign({}, state, { - visible: true + visible: true, + message: action.message }); case CLOSE_ALERT: return Object.assign({}, state, { @@ -26,8 +27,11 @@ const closeAlert = function () { return {type: CLOSE_ALERT}; }; -const showAlert = function () { - return {type: SHOW_ALERT}; +const showAlert = function (message) { + return { + type: SHOW_ALERT, + message + }; }; export {