Add role badges to WebUI (#2096)

* [Glitch] Add role badges to WebUI

Signed-off-by: Claire <claire.github-309c@sitedethib.com>

* [Glitch] Ensure role name remains readable

Signed-off-by: Claire <claire.github-309c@sitedethib.com>

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
shrike
Claire 2023-01-26 23:35:23 +01:00 committed by GitHub
parent cfa92c4ec0
commit d9a078e6d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 4 deletions

View File

@ -321,6 +321,11 @@ class Header extends ImmutablePureComponent {
badge = null;
}
let role = null;
if (account.getIn(['roles', 0])) {
role = (<div key='role' className={`account-role user-role-${account.getIn(['roles', 0, 'id'])}`}>{account.getIn(['roles', 0, 'name'])}</div>);
}
return (
<div className={classNames('account__header', { inactive: !!account.get('moved') })} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
{!(suspended || hidden || account.get('moved')) && account.getIn(['relationship', 'requested_by']) && <FollowRequestNoteContainer account={account} />}
@ -337,6 +342,7 @@ class Header extends ImmutablePureComponent {
<div className='account__header__tabs'>
<a className='avatar' href={account.get('avatar')} rel='noopener noreferrer' target='_blank' onClick={this.handleAvatarClick}>
<Avatar account={suspended || hidden ? undefined : account} size={90} />
{role}
</a>
{!suspended && (

View File

@ -214,7 +214,7 @@
font-size: 12px;
line-height: 12px;
font-weight: 500;
color: var(--user-role-accent, $ui-secondary-color);
color: $ui-secondary-color;
background-color: var(--user-role-background, rgba($ui-secondary-color, 0.1));
border: 1px solid var(--user-role-border, rgba($ui-secondary-color, 0.5));

View File

@ -533,14 +533,22 @@
&__tabs {
display: flex;
align-items: flex-start;
align-items: flex-end;
justify-content: space-between;
padding: 7px 10px;
margin-top: -55px;
gap: 8px;
margin-top: -81px;
height: 130px;
overflow: hidden;
margin-left: -2px; // aligns the pfp with content below
.account-role {
margin: 0 2px;
padding: 4px 0;
box-sizing: border-box;
min-width: 90px;
text-align: center;
}
&__buttons {
display: flex;
align-items: center;