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