import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import * as toolTabActions from '../../redux/stateActions'; import ParticipantList from '../ParticipantList/ParticipantList'; import Chat from '../Chat/Chat'; import Settings from '../Settings'; import FileSharing from '../FileSharing'; class ToolArea extends React.Component { constructor(props) { super(props); } render() { const { currentToolTab, unreadMessages, unreadFiles, setToolTab } = this.props; return (
{ setToolTab('chat'); }} checked={currentToolTab === 'chat'} />
setToolTab('files')} checked={currentToolTab === 'files'} />
{ setToolTab('users'); }} checked={currentToolTab === 'users'} />
{ setToolTab('settings'); }} checked={currentToolTab === 'settings'} />
); } } ToolArea.propTypes = { advancedMode : PropTypes.bool, currentToolTab : PropTypes.string.isRequired, setToolTab : PropTypes.func.isRequired, unreadMessages : PropTypes.number.isRequired, unreadFiles : PropTypes.number.isRequired }; const mapStateToProps = (state) => ({ currentToolTab : state.toolarea.currentToolTab, unreadMessages : state.toolarea.unreadMessages, unreadFiles : state.toolarea.unreadFiles }); const mapDispatchToProps = { setToolTab : toolTabActions.setToolTab }; const ToolAreaContainer = connect( mapStateToProps, mapDispatchToProps )(ToolArea); export default ToolAreaContainer;