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

Renaming viewAlert to showAlert.

parent 90682bdd
No related branches found
No related tags found
No related merge requests found
import {connect} from 'react-redux';
import {
viewAlert
showAlert
} from '../reducers/alerts';
import AlertsComponent from '../components/alerts/alerts.jsx';
......@@ -12,7 +12,7 @@ const mapStateToProps = state => ({
});
const mapDispatchToProps = dispatch => ({
onViewAlert: () => dispatch(viewAlert())
onShowAlert: () => dispatch(showAlert())
});
export default connect(
......
......@@ -9,7 +9,7 @@ import {updateTargets} from '../reducers/targets';
import {updateBlockDrag} from '../reducers/block-drag';
import {updateMonitors} from '../reducers/monitors';
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
......@@ -37,7 +37,7 @@ const vmListenerHOC = function (WrappedComponent) {
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_STOP', this.props.onProjectRunStop);
this.props.vm.on('PERIPHERAL_CONNECTED', this.props.onViewAlert);
this.props.vm.on('PERIPHERAL_CONNECTED', this.props.onShowAlert);
}
componentDidMount () {
if (this.props.attachKeyboardEvents) {
......@@ -95,7 +95,7 @@ const vmListenerHOC = function (WrappedComponent) {
onProjectRunStop,
onTurboModeOff,
onTurboModeOn,
onViewAlert,
onShowAlert,
/* eslint-enable no-unused-vars */
...props
} = this.props;
......@@ -139,7 +139,7 @@ const vmListenerHOC = function (WrappedComponent) {
onProjectRunStop: () => dispatch(setRunningState(false)),
onTurboModeOn: () => dispatch(setTurboState(true)),
onTurboModeOff: () => dispatch(setTurboState(false)),
onViewAlert: () => dispatch(viewAlert())
onShowAlert: () => dispatch(showAlert())
});
return connect(
mapStateToProps,
......
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 = {
message: 'testing alerts!!',
......@@ -9,7 +9,7 @@ const initialState = {
const reducer = function (state, action) {
if (typeof state === 'undefined') state = initialState;
switch (action.type) {
case VIEW_ALERT:
case SHOW_ALERT:
return Object.assign({}, state, {
visible: true
});
......@@ -26,13 +26,13 @@ const closeAlert = function () {
return {type: CLOSE_ALERT};
};
const viewAlert = function () {
return {type: VIEW_ALERT};
const showAlert = function () {
return {type: SHOW_ALERT};
};
export {
reducer as default,
initialState as alertsInitialState,
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