logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

moved_note.js (1662B)


  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import ImmutablePropTypes from 'react-immutable-proptypes';
  4. import { FormattedMessage } from 'react-intl';
  5. import ImmutablePureComponent from 'react-immutable-pure-component';
  6. import AvatarOverlay from '../../../components/avatar_overlay';
  7. import DisplayName from '../../../components/display_name';
  8. export default class MovedNote extends ImmutablePureComponent {
  9. static contextTypes = {
  10. router: PropTypes.object,
  11. };
  12. static propTypes = {
  13. from: ImmutablePropTypes.map.isRequired,
  14. to: ImmutablePropTypes.map.isRequired,
  15. };
  16. handleAccountClick = e => {
  17. if (e.button === 0) {
  18. e.preventDefault();
  19. this.context.router.history.push(`/accounts/${this.props.to.get('id')}`);
  20. }
  21. e.stopPropagation();
  22. }
  23. render () {
  24. const { from, to } = this.props;
  25. const displayNameHtml = { __html: from.get('display_name_html') };
  26. return (
  27. <div className='account__moved-note'>
  28. <div className='account__moved-note__message'>
  29. <div className='account__moved-note__icon-wrapper'><i className='fa fa-fw fa-suitcase account__moved-note__icon' /></div>
  30. <FormattedMessage id='account.moved_to' defaultMessage='{name} has moved to:' values={{ name: <bdi><strong dangerouslySetInnerHTML={displayNameHtml} /></bdi> }} />
  31. </div>
  32. <a href={to.get('url')} onClick={this.handleAccountClick} className='detailed-status__display-name'>
  33. <div className='detailed-status__display-avatar'><AvatarOverlay account={to} friend={from} /></div>
  34. <DisplayName account={to} />
  35. </a>
  36. </div>
  37. );
  38. }
  39. }