]> cat aescling's git repositories - mastodon.git/blob - app/javascript/mastodon/features/ui/components/boost_modal.js
Remove unused variables (#3906)
[mastodon.git] / app / javascript / mastodon / features / ui / components / boost_modal.js
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';
11
12 const messages = defineMessages({
13 reblog: { id: 'status.reblog', defaultMessage: 'Boost' },
14 });
15
16 class BoostModal extends ImmutablePureComponent {
17
18 static contextTypes = {
19 router: PropTypes.object,
20 };
21
22 static propTypes = {
23 status: ImmutablePropTypes.map.isRequired,
24 onReblog: PropTypes.func.isRequired,
25 onClose: PropTypes.func.isRequired,
26 intl: PropTypes.object.isRequired,
27 };
28
29 componentDidMount() {
30 this.button.focus();
31 }
32
33 handleReblog = () => {
34 this.props.onReblog(this.props.status);
35 this.props.onClose();
36 }
37
38 handleAccountClick = (e) => {
39 if (e.button === 0) {
40 e.preventDefault();
41 this.props.onClose();
42 this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
43 }
44 }
45
46 setRef = (c) => {
47 this.button = c;
48 }
49
50 render () {
51 const { status, intl } = this.props;
52
53 return (
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>
60 </div>
61
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} />
65 </div>
66
67 <DisplayName account={status.get('account')} />
68 </a>
69 </div>
70
71 <StatusContent status={status} />
72 </div>
73 </div>
74
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} />
78 </div>
79 </div>
80 );
81 }
82
83 }
84
85 export default injectIntl(BoostModal);
This page took 0.099122 seconds and 4 git commands to generate.