Skip to content
Snippets Groups Projects
Commit 1822e82a authored by Evelyn Eastmond's avatar Evelyn Eastmond
Browse files

Renaming viewAlert to showAlert.

parent 90682bdd
Loading
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import { import {
viewAlert showAlert
} from '../reducers/alerts'; } from '../reducers/alerts';
import AlertsComponent from '../components/alerts/alerts.jsx'; import AlertsComponent from '../components/alerts/alerts.jsx';
...@@ -12,7 +12,7 @@ const mapStateToProps = state => ({ ...@@ -12,7 +12,7 @@ const mapStateToProps = state => ({
}); });
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({
onViewAlert: () => dispatch(viewAlert()) onShowAlert: () => dispatch(showAlert())
}); });
export default connect( export default connect(
......
...@@ -9,7 +9,7 @@ import {updateTargets} from '../reducers/targets'; ...@@ -9,7 +9,7 @@ import {updateTargets} from '../reducers/targets';
import {updateBlockDrag} from '../reducers/block-drag'; import {updateBlockDrag} from '../reducers/block-drag';
import {updateMonitors} from '../reducers/monitors'; import {updateMonitors} from '../reducers/monitors';
import {setRunningState, setTurboState} from '../reducers/vm-status'; import {setRunningState, setTurboState} from '../reducers/vm-status';
import {viewAlert} from '../reducers/alerts'; import {showAlert} from '../reducers/alerts';
/* /*
* Higher Order Component to manage events emitted by the VM * Higher Order Component to manage events emitted by the VM
...@@ -37,7 +37,7 @@ const vmListenerHOC = function (WrappedComponent) { ...@@ -37,7 +37,7 @@ const vmListenerHOC = function (WrappedComponent) {
this.props.vm.on('TURBO_MODE_OFF', this.props.onTurboModeOff); this.props.vm.on('TURBO_MODE_OFF', this.props.onTurboModeOff);
this.props.vm.on('PROJECT_RUN_START', this.props.onProjectRunStart); this.props.vm.on('PROJECT_RUN_START', this.props.onProjectRunStart);
this.props.vm.on('PROJECT_RUN_STOP', this.props.onProjectRunStop); this.props.vm.on('PROJECT_RUN_STOP', this.props.onProjectRunStop);
this.props.vm.on('PERIPHERAL_CONNECTED', this.props.onViewAlert); this.props.vm.on('PERIPHERAL_CONNECTED', this.props.onShowAlert);
} }
componentDidMount () { componentDidMount () {
if (this.props.attachKeyboardEvents) { if (this.props.attachKeyboardEvents) {
...@@ -95,7 +95,7 @@ const vmListenerHOC = function (WrappedComponent) { ...@@ -95,7 +95,7 @@ const vmListenerHOC = function (WrappedComponent) {
onProjectRunStop, onProjectRunStop,
onTurboModeOff, onTurboModeOff,
onTurboModeOn, onTurboModeOn,
onViewAlert, onShowAlert,
/* eslint-enable no-unused-vars */ /* eslint-enable no-unused-vars */
...props ...props
} = this.props; } = this.props;
...@@ -139,7 +139,7 @@ const vmListenerHOC = function (WrappedComponent) { ...@@ -139,7 +139,7 @@ const vmListenerHOC = function (WrappedComponent) {
onProjectRunStop: () => dispatch(setRunningState(false)), onProjectRunStop: () => dispatch(setRunningState(false)),
onTurboModeOn: () => dispatch(setTurboState(true)), onTurboModeOn: () => dispatch(setTurboState(true)),
onTurboModeOff: () => dispatch(setTurboState(false)), onTurboModeOff: () => dispatch(setTurboState(false)),
onViewAlert: () => dispatch(viewAlert()) onShowAlert: () => dispatch(showAlert())
}); });
return connect( return connect(
mapStateToProps, mapStateToProps,
......
const CLOSE_ALERT = 'scratch-gui/alerts/CLOSE_ALERT'; const CLOSE_ALERT = 'scratch-gui/alerts/CLOSE_ALERT';
const VIEW_ALERT = 'scratch-gui/alerts/VIEW_ALERT'; const SHOW_ALERT = 'scratch-gui/alerts/SHOW_ALERT';
const initialState = { const initialState = {
message: 'testing alerts!!', message: 'testing alerts!!',
...@@ -9,7 +9,7 @@ const initialState = { ...@@ -9,7 +9,7 @@ const initialState = {
const reducer = function (state, action) { const reducer = function (state, action) {
if (typeof state === 'undefined') state = initialState; if (typeof state === 'undefined') state = initialState;
switch (action.type) { switch (action.type) {
case VIEW_ALERT: case SHOW_ALERT:
return Object.assign({}, state, { return Object.assign({}, state, {
visible: true visible: true
}); });
...@@ -26,13 +26,13 @@ const closeAlert = function () { ...@@ -26,13 +26,13 @@ const closeAlert = function () {
return {type: CLOSE_ALERT}; return {type: CLOSE_ALERT};
}; };
const viewAlert = function () { const showAlert = function () {
return {type: VIEW_ALERT}; return {type: SHOW_ALERT};
}; };
export { export {
reducer as default, reducer as default,
initialState as alertsInitialState, initialState as alertsInitialState,
closeAlert, closeAlert,
viewAlert showAlert
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment