import React, { Component } from 'react'; import { connect, ResolveThunks } from 'react-redux'; import { Container } from 'devui'; import SliderMonitor from './monitors/Slider'; import { liftedDispatch as liftedDispatchAction, getReport } from '../actions'; import { getActiveInstance } from '../reducers/instances'; import DevTools from '../containers/DevTools'; import Dispatcher from './monitors/Dispatcher'; import TopButtons from '../components/TopButtons'; import BottomButtons from '../components/BottomButtons'; import { StoreState } from '../reducers'; type StateProps = ReturnType; type DispatchProps = ResolveThunks; type Props = StateProps & DispatchProps; class Actions extends Component { render() { const { monitor, dispatcherIsOpen, sliderIsOpen, options, liftedState, liftedDispatch, } = this.props; return ( {sliderIsOpen && options.connectionId && options.features.jump && ( )} {dispatcherIsOpen && options.connectionId && options.features.dispatch && } ); } } const mapStateToProps = (state: StoreState) => { const instances = state.instances; const id = getActiveInstance(instances); return { liftedState: instances.states[id], monitorState: state.monitor.monitorState, options: instances.options[id], monitor: state.monitor.selected, dispatcherIsOpen: state.monitor.dispatcherIsOpen, sliderIsOpen: state.monitor.sliderIsOpen, reports: state.reports.data, }; }; const actionCreators = { liftedDispatch: liftedDispatchAction, getReport, }; export default connect(mapStateToProps, actionCreators)(Actions);