2018-02-16 18:34:25 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
2019-03-01 16:49:11 +00:00
|
|
|
import Status from './Status';
|
2020-01-29 20:20:36 +00:00
|
|
|
import { withTheme } from '../../theme';
|
2018-02-16 18:34:25 +00:00
|
|
|
|
2019-08-20 19:24:22 +00:00
|
|
|
class StatusContainer extends React.PureComponent {
|
2018-02-16 18:34:25 +00:00
|
|
|
static propTypes = {
|
2019-05-22 20:15:35 +00:00
|
|
|
style: PropTypes.any,
|
2019-03-01 16:49:11 +00:00
|
|
|
size: PropTypes.number,
|
2020-01-29 20:20:36 +00:00
|
|
|
status: PropTypes.string,
|
|
|
|
theme: PropTypes.string
|
2018-02-16 18:34:25 +00:00
|
|
|
};
|
|
|
|
|
2019-03-01 16:49:11 +00:00
|
|
|
static defaultProps = {
|
|
|
|
size: 16
|
|
|
|
}
|
|
|
|
|
2018-02-16 18:34:25 +00:00
|
|
|
render() {
|
2020-01-29 20:20:36 +00:00
|
|
|
const {
|
|
|
|
style, size, status, theme
|
|
|
|
} = this.props;
|
|
|
|
return <Status size={size} style={style} status={status} theme={theme} />;
|
2018-02-16 18:34:25 +00:00
|
|
|
}
|
|
|
|
}
|
2019-08-20 19:24:22 +00:00
|
|
|
|
2019-10-07 20:56:30 +00:00
|
|
|
const mapStateToProps = (state, ownProps) => ({
|
|
|
|
status: state.meteor.connected ? state.activeUsers[ownProps.id] : 'offline'
|
2019-08-20 19:24:22 +00:00
|
|
|
});
|
|
|
|
|
2020-01-29 20:20:36 +00:00
|
|
|
export default connect(mapStateToProps)(withTheme(StatusContainer));
|