import { React, PropTypes, FocusedContactsStore } from 'mailspring-exports'; import { InjectedComponentSet } from 'mailspring-component-kit'; class FocusedContactStorePropsContainer extends React.Component { static displayName = 'FocusedContactStorePropsContainer'; constructor(props) { super(props); this.state = this._getStateFromStores(); } componentDidMount() { this.unsubscribe = FocusedContactsStore.listen(this._onChange); } componentWillUnmount() { this.unsubscribe(); } _onChange = () => { this.setState(this._getStateFromStores()); }; _getStateFromStores() { return { sortedContacts: FocusedContactsStore.sortedContacts(), focusedContact: FocusedContactsStore.focusedContact(), focusedContactThreads: FocusedContactsStore.focusedContactThreads(), }; } render() { let classname = 'sidebar-section'; let inner = null; if (this.state.focusedContact) { classname += ' visible'; inner = React.cloneElement(this.props.children, this.state); } return