From c0e843f3fc79a349259c1983a6f4aa0454f9d9b7 Mon Sep 17 00:00:00 2001 From: Evelyn Eastmond <evhan55@gmail.com> Date: Fri, 26 Oct 2018 15:10:25 -0400 Subject: [PATCH] Hook up modal connection dispatch to reconnect button with dummy extension id. --- src/components/alerts/alerts.jsx | 8 ++------ src/containers/alert.jsx | 18 +++++++++++------- src/containers/alerts.jsx | 8 ++------ 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/components/alerts/alerts.jsx b/src/components/alerts/alerts.jsx index 88e690cb3..1835a50a8 100644 --- a/src/components/alerts/alerts.jsx +++ b/src/components/alerts/alerts.jsx @@ -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; diff --git a/src/containers/alert.jsx b/src/containers/alert.jsx index 8413998aa..fe2fed13a 100644 --- a/src/containers/alert.jsx +++ b/src/containers/alert.jsx @@ -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); diff --git a/src/containers/alerts.jsx b/src/containers/alerts.jsx index f75046d13..21a17700a 100644 --- a/src/containers/alerts.jsx +++ b/src/containers/alerts.jsx @@ -1,7 +1,6 @@ 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 => ({ -- GitLab