1 import React
from 'react';
2 import ImmutablePropTypes
from 'react-immutable-proptypes';
3 import PropTypes
from 'prop-types';
4 import { defineMessages
, injectIntl
, FormattedMessage
} from 'react-intl';
5 import Button
from '../../../components/button';
6 import StatusContent
from '../../../components/status_content';
7 import Avatar
from '../../../components/avatar';
8 import RelativeTimestamp
from '../../../components/relative_timestamp';
9 import DisplayName
from '../../../components/display_name';
10 import ImmutablePureComponent
from 'react-immutable-pure-component';
12 const messages
= defineMessages({
13 reblog: { id: 'status.reblog', defaultMessage: 'Boost' },
17 export default class BoostModal
extends ImmutablePureComponent
{
19 static contextTypes
= {
20 router: PropTypes
.object
,
24 status: ImmutablePropTypes
.map
.isRequired
,
25 onReblog: PropTypes
.func
.isRequired
,
26 onClose: PropTypes
.func
.isRequired
,
27 intl: PropTypes
.object
.isRequired
,
34 handleReblog
= () => {
35 this.props
.onReblog(this.props
.status
);
39 handleAccountClick
= (e
) => {
43 this.context
.router
.history
.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
52 const { status
, intl
} = this.props
;
55 <div className
='modal-root__modal boost-modal'>
56 <div className
='boost-modal__container'>
57 <div className
='status light'>
58 <div className
='boost-modal__status-header'>
59 <div className
='boost-modal__status-time'>
60 <a href
={status
.get('url')} className
='status__relative-time' target
='_blank' rel
='noopener'><RelativeTimestamp timestamp
={status
.get('created_at')} /></a>
63 <a onClick
={this.handleAccountClick
} href
={status
.getIn(['account', 'url'])} className
='status__display-name'>
64 <div className
='status__avatar'>
65 <Avatar account
={status
.get('account')} size
={48} />
68 <DisplayName account
={status
.get('account')} />
72 <StatusContent status
={status
} />
76 <div className
='boost-modal__action-bar'>
77 <div
><FormattedMessage id
='boost_modal.combo' defaultMessage
='You can press {combo} to skip this next time' values
={{ combo: <span
>Shift
+ <i className
='fa fa-retweet' /></span> }} /></div>
78 <Button text
={intl
.formatMessage(messages
.reblog
)} onClick
={this.handleReblog
} ref
={this.setRef
} />