import { Fragment } from 'react' import { defineMessages, injectIntl, FormattedMessage } from 'react-intl' import ImmutablePureComponent from 'react-immutable-pure-component' import ImmutablePropTypes from 'react-immutable-proptypes' import { openModal } from '../../actions/modal' import { MODAL_GROUP_MEMBERS } from '../../constants' import { shortNumberFormat } from '../../utils/numbers' import PanelLayout from './panel_layout' import Button from '../button' import Divider from '../divider' import Dummy from '../dummy' import Icon from '../icon' import Text from '../text' import RelativeTimestamp from '../relative_timestamp' const messages = defineMessages({ title: { id: 'about', defaultMessage: 'About' }, members: { id: 'members', defaultMessage: 'Members' }, }) const mapDispatchToProps = (dispatch) => ({ onOpenGroupMembersModal(groupId) { dispatch(openModal(MODAL_GROUP_MEMBERS, { groupId })) }, }) export default @injectIntl @connect(null, mapDispatchToProps) class GroupInfoPanel extends ImmutablePureComponent { static propTypes = { group: ImmutablePropTypes.map.isRequired, intl: PropTypes.object.isRequired, onOpenGroupMembersModal: PropTypes.func.isRequired, noPanel: PropTypes.bool, } handleOnOpenGroupMembersModal = () => { this.props.onOpenGroupMembersModal(this.props.group.get('id')) } render() { const { intl, group, noPanel } = this.props const Wrapper = noPanel ? Dummy : PanelLayout return ( { !!group &&
{group.get('title')}
{intl.formatMessage(messages.members)}
{ , }} /> }
{group.get('description')}
}
) } }