The code powering m.abunchtell.com https://m.abunchtell.com
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

65 linhas
2.3 KiB

  1. import ImmutablePropTypes from 'react-immutable-proptypes';
  2. import PureRenderMixin from 'react-addons-pure-render-mixin';
  3. import IconButton from './icon_button';
  4. import DropdownMenu from './dropdown_menu';
  5. import { injectIntl } from 'react-intl';
  6. const StatusActionBar = React.createClass({
  7. propTypes: {
  8. status: ImmutablePropTypes.map.isRequired,
  9. onReply: React.PropTypes.func,
  10. onFavourite: React.PropTypes.func,
  11. onReblog: React.PropTypes.func,
  12. onDelete: React.PropTypes.func,
  13. onMention: React.PropTypes.func
  14. },
  15. mixins: [PureRenderMixin],
  16. handleReplyClick () {
  17. this.props.onReply(this.props.status);
  18. },
  19. handleFavouriteClick () {
  20. this.props.onFavourite(this.props.status);
  21. },
  22. handleReblogClick () {
  23. this.props.onReblog(this.props.status);
  24. },
  25. handleDeleteClick () {
  26. this.props.onDelete(this.props.status);
  27. },
  28. handleMentionClick () {
  29. this.props.onMention(this.props.status.get('account'));
  30. },
  31. render () {
  32. const { status, me, intl } = this.props;
  33. let menu = [];
  34. if (status.getIn(['account', 'id']) === me) {
  35. menu.push({ text: intl.formatMessage({ id: 'status.delete', defaultMessage: 'Delete' }), action: this.handleDeleteClick });
  36. } else {
  37. menu.push({ text: intl.formatMessage({ id: 'status.mention', defaultMessage: 'Mention' }), action: this.handleMentionClick });
  38. }
  39. return (
  40. <div style={{ marginTop: '10px', overflow: 'hidden' }}>
  41. <div style={{ float: 'left', marginRight: '18px'}}><IconButton title={intl.formatMessage({ id: 'status.reply', defaultMessage: 'Reply' })} icon='reply' onClick={this.handleReplyClick} /></div>
  42. <div style={{ float: 'left', marginRight: '18px'}}><IconButton active={status.get('reblogged')} title={intl.formatMessage({ id: 'status.reblog', defaultMessage: 'Reblog' })} icon='retweet' onClick={this.handleReblogClick} /></div>
  43. <div style={{ float: 'left', marginRight: '18px'}}><IconButton active={status.get('favourited')} title={intl.formatMessage({ id: 'status.favourite', defaultMessage: 'Favourite' })} icon='star' onClick={this.handleFavouriteClick} activeStyle={{ color: '#ca8f04' }} /></div>
  44. <div style={{ width: '18px', height: '18px', float: 'left' }}>
  45. <DropdownMenu items={menu} icon='ellipsis-h' size={18} />
  46. </div>
  47. </div>
  48. );
  49. }
  50. });
  51. export default injectIntl(StatusActionBar);