import React, { Component } from 'react'; import { connect, ResolveThunks } from 'react-redux'; import { Container, Notification } from '@redux-devtools/ui'; import { clearNotification, getActiveInstance, Header, Settings, StoreState, } from '@redux-devtools/app'; import Actions from './Actions'; type StateProps = ReturnType; type DispatchProps = ResolveThunks; interface OwnProps { readonly position: string; } type Props = StateProps & DispatchProps & OwnProps; class App extends Component { render() { const { position, options, section, theme, notification } = this.props; if (!position && (!options || !options.features)) { return (
No store found. Make sure to follow{' '} the instructions .
); } let body; switch (section) { case 'Settings': body = ; break; default: body = ; } return (
{body} {notification && ( {notification.message} )} ); } } function mapStateToProps(state: StoreState) { const instances = state.instances; const id = getActiveInstance(instances); return { options: instances.options[id], section: state.section, theme: state.theme, notification: state.notification, }; } const actionCreators = { clearNotification, }; export default connect(mapStateToProps, actionCreators)(App);