You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.9 KiB

  1. import React from 'react';
  2. import ImmutablePropTypes from 'react-immutable-proptypes';
  3. import PropTypes from 'prop-types';
  4. import Avatar from 'mastodon/components/avatar';
  5. import DisplayName from 'mastodon/components/display_name';
  6. import { Link } from 'react-router-dom';
  7. import IconButton from 'mastodon/components/icon_button';
  8. import { defineMessages, injectIntl } from 'react-intl';
  9. import ImmutablePureComponent from 'react-immutable-pure-component';
  10. const messages = defineMessages({
  11. authorize: { id: 'follow_request.authorize', defaultMessage: 'Authorize' },
  12. reject: { id: 'follow_request.reject', defaultMessage: 'Reject' },
  13. });
  14. class FollowRequest extends ImmutablePureComponent {
  15. static propTypes = {
  16. account: ImmutablePropTypes.map.isRequired,
  17. onAuthorize: PropTypes.func.isRequired,
  18. onReject: PropTypes.func.isRequired,
  19. intl: PropTypes.object.isRequired,
  20. };
  21. render () {
  22. const { intl, hidden, account, onAuthorize, onReject } = this.props;
  23. if (!account) {
  24. return <div />;
  25. }
  26. if (hidden) {
  27. return (
  28. <React.Fragment>
  29. {account.get('display_name')}
  30. {account.get('username')}
  31. </React.Fragment>
  32. );
  33. }
  34. return (
  35. <div className='account'>
  36. <div className='account__wrapper'>
  37. <Link key={account.get('id')} className='account__display-name' title={account.get('acct')} to={`/@${account.get('acct')}`}>
  38. <div className='account__avatar-wrapper'><Avatar account={account} size={36} /></div>
  39. <DisplayName account={account} />
  40. </Link>
  41. <div className='account__relationship'>
  42. <IconButton title={intl.formatMessage(messages.authorize)} icon='check' onClick={onAuthorize} />
  43. <IconButton title={intl.formatMessage(messages.reject)} icon='times' onClick={onReject} />
  44. </div>
  45. </div>
  46. </div>
  47. );
  48. }
  49. }
  50. export default injectIntl(FollowRequest);