import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import Button from 'gabsocial/components/button'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { defineMessages, injectIntl } from 'react-intl'; import { NavLink } from 'react-router-dom'; const messages = defineMessages({ join: { id: 'groups.join', defaultMessage: 'Join group' }, leave: { id: 'groups.leave', defaultMessage: 'Leave group' }, }); export default @injectIntl class Header extends ImmutablePureComponent { static propTypes = { group: ImmutablePropTypes.map, relationships: ImmutablePropTypes.map, toggleMembership: PropTypes.func.isRequired, }; static contextTypes = { router: PropTypes.object, }; getActionButton() { const { group, relationships, toggleMembership, intl } = this.props; const toggle = () => toggleMembership(group, relationships); if (!relationships) { return ''; } else if (!relationships.get('member')) { return