2018-03-29 08:43:20 -04:00
import { FormattedMessage } from 'react-intl' ;
2023-05-28 10:38:10 -04:00
2023-10-19 13:44:55 -04:00
import { withRouter } from 'react-router-dom' ;
2023-05-28 10:38:10 -04:00
import ImmutablePropTypes from 'react-immutable-proptypes' ;
2018-03-29 08:43:20 -04:00
import ImmutablePureComponent from 'react-immutable-pure-component' ;
2023-05-28 10:38:10 -04:00
2023-10-24 13:45:08 -04:00
2024-01-16 05:27:26 -05:00
import TripIcon from '@/material-icons/400-24px/trip.svg?react' ;
2023-05-28 10:38:10 -04:00
import { Icon } from 'flavours/glitch/components/icon' ;
2023-10-19 13:44:55 -04:00
import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router' ;
2023-05-28 10:38:10 -04:00
2023-12-09 12:33:42 -05:00
import { AvatarOverlay } from '../../../components/avatar_overlay' ;
2023-05-09 17:08:54 -04:00
import { DisplayName } from '../../../components/display_name' ;
2018-03-29 08:43:20 -04:00
2023-10-19 13:44:55 -04:00
class MovedNote extends ImmutablePureComponent {
2018-03-29 08:43:20 -04:00
static propTypes = {
from : ImmutablePropTypes . map . isRequired ,
to : ImmutablePropTypes . map . isRequired ,
2023-10-19 13:44:55 -04:00
... WithRouterPropTypes ,
2018-03-29 08:43:20 -04:00
} ;
handleAccountClick = e => {
if ( e . button === 0 ) {
e . preventDefault ( ) ;
2023-10-19 13:44:55 -04:00
this . props . history . push ( ` /@ ${ this . props . to . get ( 'acct' ) } ` ) ;
2018-03-29 08:43:20 -04:00
}
e . stopPropagation ( ) ;
2023-02-03 14:52:07 -05:00
} ;
2018-03-29 08:43:20 -04:00
render ( ) {
const { from , to } = this . props ;
const displayNameHtml = { _ _html : from . get ( 'display_name_html' ) } ;
return (
< div className = 'account__moved-note' >
< div className = 'account__moved-note__message' >
2023-10-24 13:45:08 -04:00
< div className = 'account__moved-note__icon-wrapper' > < Icon id = 'suitcase' className = 'account__moved-note__icon' icon = { TripIcon } / > < / div >
2023-06-10 13:21:44 -04:00
< FormattedMessage id = 'account.moved_to' defaultMessage = '{name} has indicated that their new account is now:' values = { { name : < bdi > < strong dangerouslySetInnerHTML = { displayNameHtml } / > < / bdi > } } / >
2018-03-29 08:43:20 -04:00
< / div >
< a href = { to . get ( 'url' ) } onClick = { this . handleAccountClick } className = 'detailed-status__display-name' >
< div className = 'detailed-status__display-avatar' > < AvatarOverlay account = { to } friend = { from } / > < / div >
< DisplayName account = { to } / >
< / a >
< / div >
) ;
}
}
2023-10-19 13:44:55 -04:00
export default withRouter ( MovedNote ) ;