add verification icon on verified users

This commit is contained in:
Mary Kate 2020-08-05 12:08:52 -05:00
parent 19e3dc9ed3
commit c9b2b66283
4 changed files with 22 additions and 8 deletions

View File

@ -16,13 +16,14 @@ export default class DisplayName extends React.PureComponent {
const { account, others, children } = this.props; const { account, others, children } = this.props;
let displayName, suffix; let displayName, suffix;
const verified = account.get('pleroma').get('tags').includes('verified');
if (others && others.size > 1) { if (others && others.size > 1) {
displayName = others.take(2).map(a => [ displayName = others.take(2).map(a => [
<bdi key={a.get('id')}> <bdi key={a.get('id')}>
<strong className='display-name__html' dangerouslySetInnerHTML={{ __html: a.get('display_name_html') }} /> <strong className='display-name__html' dangerouslySetInnerHTML={{ __html: a.get('display_name_html') }} />
</bdi>, </bdi>,
a.get('is_verified') && <VerificationBadge />, verified && <VerificationBadge />,
]).reduce((prev, cur) => [prev, ', ', cur]); ]).reduce((prev, cur) => [prev, ', ', cur]);
if (others.size - 2 > 0) { if (others.size - 2 > 0) {
@ -32,7 +33,7 @@ export default class DisplayName extends React.PureComponent {
displayName = ( displayName = (
<> <>
<bdi><strong className='display-name__html' dangerouslySetInnerHTML={{ __html: account.get('display_name_html') }} /></bdi> <bdi><strong className='display-name__html' dangerouslySetInnerHTML={{ __html: account.get('display_name_html') }} /></bdi>
{account.get('is_verified') && <VerificationBadge />} {verified && <VerificationBadge />}
</> </>
); );
suffix = <span className='display-name__account'>@{acctFull(account)}</span>; suffix = <span className='display-name__account'>@{acctFull(account)}</span>;

View File

@ -59,6 +59,7 @@ class ProfileInfoPanel extends ImmutablePureComponent {
const fields = account.get('fields'); const fields = account.get('fields');
const displayNameHtml = { __html: account.get('display_name_html') }; const displayNameHtml = { __html: account.get('display_name_html') };
const memberSinceDate = intl.formatDate(account.get('created_at'), { month: 'long', year: 'numeric' }); const memberSinceDate = intl.formatDate(account.get('created_at'), { month: 'long', year: 'numeric' });
const verified = account.get('pleroma').get('tags').includes('verified');
return ( return (
<div className='profile-info-panel'> <div className='profile-info-panel'>
@ -67,7 +68,7 @@ class ProfileInfoPanel extends ImmutablePureComponent {
<div className='profile-info-panel-content__name'> <div className='profile-info-panel-content__name'>
<h1> <h1>
<span dangerouslySetInnerHTML={displayNameHtml} /> <span dangerouslySetInnerHTML={displayNameHtml} />
{account.get('is_verified') && <VerificationBadge />} {verified && <VerificationBadge />}
{badge} {badge}
<small>@{acctFull(account)} {lockedIcon}</small> <small>@{acctFull(account)} {lockedIcon}</small>
</h1> </h1>

View File

@ -10,6 +10,7 @@ import Avatar from 'soapbox/components/avatar';
import { shortNumberFormat } from 'soapbox/utils/numbers'; import { shortNumberFormat } from 'soapbox/utils/numbers';
import { acctFull } from 'soapbox/utils/accounts'; import { acctFull } from 'soapbox/utils/accounts';
import StillImage from 'soapbox/components/still_image'; import StillImage from 'soapbox/components/still_image';
import VerificationBadge from 'soapbox/components/verification_badge';
class UserPanel extends ImmutablePureComponent { class UserPanel extends ImmutablePureComponent {
@ -24,6 +25,7 @@ class UserPanel extends ImmutablePureComponent {
if (!account) return null; if (!account) return null;
const displayNameHtml = { __html: account.get('display_name_html') }; const displayNameHtml = { __html: account.get('display_name_html') };
const acct = account.get('acct').indexOf('@') === -1 && domain ? `${account.get('acct')}@${domain}` : account.get('acct'); const acct = account.get('acct').indexOf('@') === -1 && domain ? `${account.get('acct')}@${domain}` : account.get('acct');
const verified = account.get('pleroma').get('tags').includes('verified');
return ( return (
<div className='user-panel'> <div className='user-panel'>
@ -45,6 +47,7 @@ class UserPanel extends ImmutablePureComponent {
<h1> <h1>
<Link to={`/@${account.get('acct')}`}> <Link to={`/@${account.get('acct')}`}>
<span className='user-panel__account__name' dangerouslySetInnerHTML={displayNameHtml} /> <span className='user-panel__account__name' dangerouslySetInnerHTML={displayNameHtml} />
{verified && <VerificationBadge />}
<small className='user-panel__account__username'>@{acctFull(account)}</small> <small className='user-panel__account__username'>@{acctFull(account)}</small>
</Link> </Link>
</h1> </h1>

View File

@ -4,12 +4,21 @@
width: 265px; width: 265px;
flex-direction: column; flex-direction: column;
.user-panel__account__name {
display: inline;
}
.verified-icon {
opacity: 1;
}
&, &,
.user-panel__account__name, .user-panel__account__name,
.user-panel__account__username { .user-panel__account__username {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
color: var(--primary-text-color--faint);
} }
&__header { &__header {
@ -49,13 +58,13 @@
&__meta { &__meta {
display: block; display: block;
padding: 6px 20px 17px; padding: 6px 20px 17px;
opacity: 0.6; // opacity: 0.6;
} }
&__account { &__account {
a { a {
text-decoration: none; text-decoration: none;
color: var(--primary-text-color); color: var(--primary-text-color--faint);
} }
&__name { &__name {
@ -63,7 +72,7 @@
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
line-height: 24px; line-height: 24px;
color: var(--primary-text-color); color: var(--primary-text-color--faint);
} }
&:hover & { &:hover & {
@ -96,7 +105,7 @@
a { a {
text-decoration: none; text-decoration: none;
color: var(--primary-text-color); color: var(--primary-text-color--faint);
&:hover { &:hover {
opacity: 0.8; opacity: 0.8;
@ -106,7 +115,7 @@
&__value { &__value {
display: block; display: block;
width: 100%; width: 100%;
color: var(--primary-text-color); color: var(--primary-text-color--faint);
font-size: 20px; font-size: 20px;
font-weight: 800; font-weight: 800;
line-height: 24px; line-height: 24px;