Change design of moved account banner in web UI (#19790)

main
Eugen Rochko 2022-11-05 21:11:24 +01:00 committed by GitHub
parent 30e786225e
commit 7c65f52692
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 46 deletions

View File

@ -1,47 +1,35 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import AvatarOverlay from '../../../components/avatar_overlay'; import AvatarOverlay from '../../../components/avatar_overlay';
import DisplayName from '../../../components/display_name'; import DisplayName from '../../../components/display_name';
import Icon from 'mastodon/components/icon'; import Permalink from 'mastodon/components/permalink';
export default class MovedNote extends ImmutablePureComponent { export default class MovedNote extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object,
};
static propTypes = { static propTypes = {
from: ImmutablePropTypes.map.isRequired, from: ImmutablePropTypes.map.isRequired,
to: ImmutablePropTypes.map.isRequired, to: ImmutablePropTypes.map.isRequired,
}; };
handleAccountClick = e => {
if (e.button === 0) {
e.preventDefault();
this.context.router.history.push(`/@${this.props.to.get('acct')}`);
}
e.stopPropagation();
}
render () { render () {
const { from, to } = this.props; const { from, to } = this.props;
const displayNameHtml = { __html: from.get('display_name_html') };
return ( return (
<div className='account__moved-note'> <div className='moved-account-banner'>
<div className='account__moved-note__message'> <div className='moved-account-banner__message'>
<div className='account__moved-note__icon-wrapper'><Icon id='suitcase' className='account__moved-note__icon' fixedWidth /></div> <FormattedMessage id='account.moved_to' defaultMessage='{name} has indicated that their new account is now:' values={{ name: <bdi><strong dangerouslySetInnerHTML={{ __html: from.get('display_name_html') }} /></bdi> }} />
<FormattedMessage id='account.moved_to' defaultMessage='{name} has moved to:' values={{ name: <bdi><strong dangerouslySetInnerHTML={displayNameHtml} /></bdi> }} />
</div> </div>
<a href={to.get('url')} onClick={this.handleAccountClick} className='detailed-status__display-name'> <div className='moved-account-banner__action'>
<Permalink href={to.get('url')} to={`/@${to.get('acct')}`} className='detailed-status__display-name'>
<div className='detailed-status__display-avatar'><AvatarOverlay account={to} friend={from} /></div> <div className='detailed-status__display-avatar'><AvatarOverlay account={to} friend={from} /></div>
<DisplayName account={to} /> <DisplayName account={to} />
</a> </Permalink>
<Permalink href={to.get('url')} to={`/@${to.get('acct')}`} className='button'><FormattedMessage id='account.go_to_profile' defaultMessage='Go to profile' /></Permalink>
</div>
</div> </div>
); );
} }

View File

@ -46,7 +46,7 @@
"account.locked_info": "This account privacy status is set to locked. The owner manually reviews who can follow them.", "account.locked_info": "This account privacy status is set to locked. The owner manually reviews who can follow them.",
"account.media": "Media", "account.media": "Media",
"account.mention": "Mention @{name}", "account.mention": "Mention @{name}",
"account.moved_to": "{name} has moved to:", "account.moved_to": "{name} has indicated that their new account is now:",
"account.mute": "Mute @{name}", "account.mute": "Mute @{name}",
"account.mute_notifications": "Mute notifications from @{name}", "account.mute_notifications": "Mute notifications from @{name}",
"account.muted": "Muted", "account.muted": "Muted",

View File

@ -6733,36 +6733,29 @@ noscript {
} }
} }
.account__moved-note { .moved-account-banner {
padding: 14px 10px; padding: 20px;
padding-bottom: 16px;
background: lighten($ui-base-color, 4%); background: lighten($ui-base-color, 4%);
border-top: 1px solid lighten($ui-base-color, 8%); display: flex;
border-bottom: 1px solid lighten($ui-base-color, 8%); align-items: center;
flex-direction: column;
&__message { &__message {
position: relative; color: $darker-text-color;
margin-left: 58px;
color: $dark-text-color;
padding: 8px 0; padding: 8px 0;
padding-top: 0; padding-top: 0;
padding-bottom: 4px; padding-bottom: 4px;
font-size: 14px; font-size: 14px;
font-weight: 500;
> span { text-align: center;
display: block; margin-bottom: 16px;
overflow: hidden;
text-overflow: ellipsis;
}
} }
&__icon-wrapper { &__action {
left: -26px; display: flex;
position: absolute; justify-content: space-between;
} align-items: center;
gap: 15px;
.detailed-status__display-avatar {
position: relative;
} }
.detailed-status__display-name { .detailed-status__display-name {