2016-09-23 21:23:26 +03:00
|
|
|
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
import Button from '../../../components/button';
|
|
|
|
|
|
|
|
const ActionBar = React.createClass({
|
|
|
|
|
|
|
|
propTypes: {
|
|
|
|
account: ImmutablePropTypes.map.isRequired,
|
|
|
|
me: React.PropTypes.number.isRequired,
|
|
|
|
onFollow: React.PropTypes.func.isRequired,
|
|
|
|
onUnfollow: React.PropTypes.func.isRequired
|
|
|
|
},
|
|
|
|
|
|
|
|
mixins: [PureRenderMixin],
|
|
|
|
|
|
|
|
render () {
|
|
|
|
const { account, me } = this.props;
|
|
|
|
|
2016-09-25 15:58:07 +03:00
|
|
|
let infoText = '';
|
2016-09-23 21:23:26 +03:00
|
|
|
let actionButton = '';
|
|
|
|
|
|
|
|
if (account.get('id') === me) {
|
2016-09-25 15:58:07 +03:00
|
|
|
infoText = 'This is you!';
|
2016-09-23 21:23:26 +03:00
|
|
|
} else {
|
|
|
|
if (account.getIn(['relationship', 'following'])) {
|
|
|
|
actionButton = <Button text='Unfollow' onClick={this.props.onUnfollow} />
|
|
|
|
} else {
|
|
|
|
actionButton = <Button text='Follow' onClick={this.props.onFollow} />
|
|
|
|
}
|
|
|
|
|
|
|
|
if (account.getIn(['relationship', 'followed_by'])) {
|
2016-09-25 15:58:07 +03:00
|
|
|
infoText = 'Follows you!';
|
2016-09-23 21:23:26 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2016-09-25 16:48:20 +03:00
|
|
|
<div style={{ borderTop: '1px solid #363c4b', borderBottom: '1px solid #363c4b', padding: '10px', lineHeight: '36px', overflow: 'hidden', flex: '0 0 auto' }}>
|
|
|
|
{actionButton} <span style={{ color: '#616b86', fontWeight: '500', textTransform: 'uppercase', float: 'right', display: 'block' }}>{infoText}</span>
|
2016-09-23 21:23:26 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
export default ActionBar;
|