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

Hook up modal connection dispatch to reconnect button with dummy extension id.

parent cc367061
No related branches found
No related tags found
No related merge requests found
...@@ -3,13 +3,11 @@ import PropTypes from 'prop-types'; ...@@ -3,13 +3,11 @@ import PropTypes from 'prop-types';
import Box from '../box/box.jsx'; import Box from '../box/box.jsx';
import Alert from '../../containers/alert.jsx'; import Alert from '../../containers/alert.jsx';
import VM from 'scratch-vm';
const AlertsComponent = ({ const AlertsComponent = ({
alertsList, alertsList,
className, className,
onCloseAlert, onCloseAlert
vm
}) => ( }) => (
<Box <Box
bounds="parent" bounds="parent"
...@@ -21,7 +19,6 @@ const AlertsComponent = ({ ...@@ -21,7 +19,6 @@ const AlertsComponent = ({
index={index} index={index}
key={index} key={index}
message={a.message} message={a.message}
vm={vm}
onCloseAlert={onCloseAlert} onCloseAlert={onCloseAlert}
/> />
))} ))}
...@@ -31,8 +28,7 @@ const AlertsComponent = ({ ...@@ -31,8 +28,7 @@ const AlertsComponent = ({
AlertsComponent.propTypes = { AlertsComponent.propTypes = {
alertsList: PropTypes.arrayOf(PropTypes.object), alertsList: PropTypes.arrayOf(PropTypes.object),
className: PropTypes.string, className: PropTypes.string,
onCloseAlert: PropTypes.func, onCloseAlert: PropTypes.func
vm: PropTypes.instanceOf(VM).isRequired
}; };
export default AlertsComponent; export default AlertsComponent;
...@@ -2,7 +2,6 @@ import React from 'react'; ...@@ -2,7 +2,6 @@ import React from 'react';
import bindAll from 'lodash.bindall'; import bindAll from 'lodash.bindall';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import VM from 'scratch-vm';
import AlertComponent from '../components/alerts/alert.jsx'; import AlertComponent from '../components/alerts/alert.jsx';
import {openConnectionModal} from '../reducers/modals'; import {openConnectionModal} from '../reducers/modals';
...@@ -12,15 +11,16 @@ class Alert extends React.Component { ...@@ -12,15 +11,16 @@ class Alert extends React.Component {
constructor (props) { constructor (props) {
super(props); super(props);
bindAll(this, [ bindAll(this, [
'handleOnCloseAlert' 'handleOnCloseAlert',
'handleOnReconnect'
]); ]);
} }
handleOnCloseAlert () { handleOnCloseAlert () {
this.props.onCloseAlert(this.props.index); this.props.onCloseAlert(this.props.index);
} }
handleOnReconnect () { handleOnReconnect () {
// this.props.vm.emit('') this.props.onOpenConnectionModal('ev3')
console.log('hello'); console.log('handleOnReconnect');
} }
render () { render () {
const { const {
...@@ -39,6 +39,10 @@ class Alert extends React.Component { ...@@ -39,6 +39,10 @@ class Alert extends React.Component {
} }
} }
const mapStateToProps = state => ({
state: state
});
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({
onOpenConnectionModal: id => { onOpenConnectionModal: id => {
dispatch(setConnectionModalExtensionId(id)); dispatch(setConnectionModalExtensionId(id));
...@@ -51,10 +55,10 @@ Alert.propTypes = { ...@@ -51,10 +55,10 @@ Alert.propTypes = {
index: PropTypes.number, index: PropTypes.number,
message: PropTypes.string, message: PropTypes.string,
onCloseAlert: PropTypes.func.isRequired, onCloseAlert: PropTypes.func.isRequired,
onOpenConnectionModal: PropTypes.func, onOpenConnectionModal: PropTypes.func
vm: PropTypes.instanceOf(VM).isRequired
}; };
export default connect( export default connect(
mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(Alerts); )(Alert);
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import VM from 'scratch-vm';
import { import {
closeAlert closeAlert
...@@ -12,13 +11,11 @@ import AlertsComponent from '../components/alerts/alerts.jsx'; ...@@ -12,13 +11,11 @@ import AlertsComponent from '../components/alerts/alerts.jsx';
const Alerts = ({ const Alerts = ({
alertsList, alertsList,
className, className,
onCloseAlert, onCloseAlert
vm
}) => ( }) => (
<AlertsComponent <AlertsComponent
alertsList={alertsList} alertsList={alertsList}
className={className} className={className}
vm={vm}
onCloseAlert={onCloseAlert} onCloseAlert={onCloseAlert}
/> />
); );
...@@ -26,8 +23,7 @@ const Alerts = ({ ...@@ -26,8 +23,7 @@ const Alerts = ({
Alerts.propTypes = { Alerts.propTypes = {
alertsList: PropTypes.arrayOf(PropTypes.object), alertsList: PropTypes.arrayOf(PropTypes.object),
className: PropTypes.string, className: PropTypes.string,
onCloseAlert: PropTypes.func, onCloseAlert: PropTypes.func
vm: PropTypes.instanceOf(VM).isRequired
}; };
const mapStateToProps = state => ({ const mapStateToProps = state => ({
......
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