about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features/follow_requests/components/account_authorize.jsx
blob: 1766655c20f0591a7830f6bae040599b2afe62f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import ImmutablePropTypes from 'react-immutable-proptypes';
import Permalink from '../../../components/permalink';
import Avatar from '../../../components/avatar';
import DisplayName from '../../../components/display_name';
import emojify from '../../../emoji';
import IconButton from '../../../components/icon_button';
import { defineMessages, injectIntl } from 'react-intl';

const messages = defineMessages({
  authorize: { id: 'follow_request.authorize', defaultMessage: 'Authorize' },
  reject: { id: 'follow_request.reject', defaultMessage: 'Reject' }
});

const outerStyle = {
  padding: '14px 10px'
};

const panelStyle = {
  display: 'flex',
  flexDirection: 'row',
  padding: '10px 0'
};

const btnStyle = {
  flex: '1 1 auto',
  textAlign: 'center'
};

const AccountAuthorize = ({ intl, account, onAuthorize, onReject }) => {
  const content = { __html: emojify(account.get('note')) };

  return (
    <div>
      <div style={outerStyle}>
        <Permalink href={account.get('url')} to={`/accounts/${account.get('id')}`} className='detailed-status__display-name' style={{ display: 'block', overflow: 'hidden', marginBottom: '15px' }}>
          <div style={{ float: 'left', marginRight: '10px' }}><Avatar src={account.get('avatar')} size={48} /></div>
          <DisplayName account={account} />
        </Permalink>

        <div style={{ fontSize: '14px' }} className='account__header__content' dangerouslySetInnerHTML={content} />
      </div>

      <div className='account--panel' style={panelStyle}>
        <div style={btnStyle}><IconButton title={intl.formatMessage(messages.authorize)} icon='check' onClick={onAuthorize} /></div>
        <div style={btnStyle}><IconButton title={intl.formatMessage(messages.reject)} icon='times' onClick={onReject} /></div>
      </div>
    </div>
  )
};

AccountAuthorize.propTypes = {
  account: ImmutablePropTypes.map.isRequired,
  onAuthorize: React.PropTypes.func.isRequired,
  onReject: React.PropTypes.func.isRequired,
  intl: React.PropTypes.object.isRequired
};

export default injectIntl(AccountAuthorize);