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.

47 lines
1.5 KiB

  1. import React from 'react';
  2. import { connect } from 'react-redux';
  3. import ImmutablePureComponent from 'react-immutable-pure-component';
  4. import ImmutablePropTypes from 'react-immutable-proptypes';
  5. import PropTypes from 'prop-types';
  6. import IconButton from 'mastodon/components/icon_button';
  7. import { Link } from 'react-router-dom';
  8. import Avatar from 'mastodon/components/avatar';
  9. import DisplayName from 'mastodon/components/display_name';
  10. import { defineMessages, injectIntl } from 'react-intl';
  11. const messages = defineMessages({
  12. close: { id: 'lightbox.close', defaultMessage: 'Close' },
  13. });
  14. const mapStateToProps = (state, { accountId }) => ({
  15. account: state.getIn(['accounts', accountId]),
  16. });
  17. export default @connect(mapStateToProps)
  18. @injectIntl
  19. class Header extends ImmutablePureComponent {
  20. static propTypes = {
  21. accountId: PropTypes.string.isRequired,
  22. statusId: PropTypes.string.isRequired,
  23. account: ImmutablePropTypes.map.isRequired,
  24. onClose: PropTypes.func.isRequired,
  25. intl: PropTypes.object.isRequired,
  26. };
  27. render () {
  28. const { account, statusId, onClose, intl } = this.props;
  29. return (
  30. <div className='picture-in-picture__header'>
  31. <Link to={`/statuses/${statusId}`} className='picture-in-picture__header__account'>
  32. <Avatar account={account} size={36} />
  33. <DisplayName account={account} />
  34. </Link>
  35. <IconButton icon='times' onClick={onClose} title={intl.formatMessage(messages.close)} />
  36. </div>
  37. );
  38. }
  39. }