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' },
16 class BoostModal
extends ImmutablePureComponent
{
18 static contextTypes
= {
19 router: PropTypes
.object
,
23 status: ImmutablePropTypes
.map
.isRequired
,
24 onReblog: PropTypes
.func
.isRequired
,
25 onClose: PropTypes
.func
.isRequired
,
26 intl: PropTypes
.object
.isRequired
,
33 handleReblog
= () => {
34 this.props
.onReblog(this.props
.status
);
38 handleAccountClick
= (e
) => {
42 this.context
.router
.history
.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
51 const { status
, intl
} = this.props
;
54 <div className
='modal-root__modal boost-modal'>
55 <div className
='boost-modal__container'>
56 <div className
='status light'>
57 <div className
='boost-modal__status-header'>
58 <div className
='boost-modal__status-time'>
59 <a href
={status
.get('url')} className
='status__relative-time' target
='_blank' rel
='noopener'><RelativeTimestamp timestamp
={status
.get('created_at')} /></a>
62 <a onClick
={this.handleAccountClick
} href
={status
.getIn(['account', 'url'])} className
='status__display-name'>
63 <div className
='status__avatar'>
64 <Avatar src
={status
.getIn(['account', 'avatar'])} staticSrc
={status
.getIn(['account', 'avatar_static'])} size
={48} />
67 <DisplayName account
={status
.get('account')} />
71 <StatusContent status
={status
} />
75 <div className
='boost-modal__action-bar'>
76 <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>
77 <Button text
={intl
.formatMessage(messages
.reblog
)} onClick
={this.handleReblog
} ref
={this.setRef
} />
85 export default injectIntl(BoostModal
);