The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

50 lines
1.7 KiB

  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. import Icon from 'mastodon/components/icon';
  9. export default class MovedNote extends ImmutablePureComponent {
  10. static contextTypes = {
  11. router: PropTypes.object,
  12. };
  13. static propTypes = {
  14. from: ImmutablePropTypes.map.isRequired,
  15. to: ImmutablePropTypes.map.isRequired,
  16. };
  17. handleAccountClick = e => {
  18. if (e.button === 0) {
  19. e.preventDefault();
  20. this.context.router.history.push(`/accounts/${this.props.to.get('id')}`);
  21. }
  22. e.stopPropagation();
  23. }
  24. render () {
  25. const { from, to } = this.props;
  26. const displayNameHtml = { __html: from.get('display_name_html') };
  27. return (
  28. <div className='account__moved-note'>
  29. <div className='account__moved-note__message'>
  30. <div className='account__moved-note__icon-wrapper'><Icon id='suitcase' className='account__moved-note__icon' fixedWidth /></div>
  31. <FormattedMessage id='account.moved_to' defaultMessage='{name} has moved to:' values={{ name: <bdi><strong dangerouslySetInnerHTML={displayNameHtml} /></bdi> }} />
  32. </div>
  33. <a href={to.get('url')} onClick={this.handleAccountClick} className='detailed-status__display-name'>
  34. <div className='detailed-status__display-avatar'><AvatarOverlay account={to} friend={from} /></div>
  35. <DisplayName account={to} />
  36. </a>
  37. </div>
  38. );
  39. }
  40. }