import ImmutablePropTypes from 'react-immutable-proptypes'; import Avatar from './avatar'; import RelativeTimestamp from './relative_timestamp'; import PureRenderMixin from 'react-addons-pure-render-mixin'; import IconButton from './icon_button'; import DisplayName from './display_name'; import MediaGallery from './media_gallery'; import { hashHistory } from 'react-router'; const Status = React.createClass({ propTypes: { status: ImmutablePropTypes.map.isRequired, wrapped: React.PropTypes.bool, onReply: React.PropTypes.func, onFavourite: React.PropTypes.func, onReblog: React.PropTypes.func }, mixins: [PureRenderMixin], handleReplyClick () { this.props.onReply(this.props.status); }, handleFavouriteClick () { this.props.onFavourite(this.props.status); }, handleReblogClick () { this.props.onReblog(this.props.status); }, handleClick () { const { status } = this.props; hashHistory.push(`/statuses/${status.getIn(['reblog', 'id'], status.get('id'))}`); }, handleAccountClick (id, e) { if (e.button === 0) { e.preventDefault(); hashHistory.push(`/accounts/${id}`); } e.stopPropagation(); }, render () { var content = { __html: this.props.status.get('content') }; var media = ''; var { status, ...other } = this.props; if (status.get('reblog') !== null) { return (
{status.getIn(['account', 'display_name'])} reblogged
); } if (status.get('media_attachments').size > 0) { media = ; } return (
{media}
); } }); export default Status;