mirror of
https://github.com/funamitech/mastodon
synced 2024-12-05 10:18:45 +09:00
[Glitch] Add the role ID to the badge component
Port ec1e770fea
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
777984faeb
commit
576c085ea0
@ -7,8 +7,8 @@ import PersonIcon from '@/material-icons/400-24px/person.svg?react';
|
|||||||
import SmartToyIcon from '@/material-icons/400-24px/smart_toy.svg?react';
|
import SmartToyIcon from '@/material-icons/400-24px/smart_toy.svg?react';
|
||||||
|
|
||||||
|
|
||||||
export const Badge = ({ icon, label, domain }) => (
|
export const Badge = ({ icon, label, domain, roleId }) => (
|
||||||
<div className='account-role'>
|
<div className='account-role' data-account-role-id={roleId}>
|
||||||
{icon}
|
{icon}
|
||||||
{label}
|
{label}
|
||||||
{domain && <span className='account-role__domain'>{domain}</span>}
|
{domain && <span className='account-role__domain'>{domain}</span>}
|
||||||
@ -19,6 +19,7 @@ Badge.propTypes = {
|
|||||||
icon: PropTypes.node,
|
icon: PropTypes.node,
|
||||||
label: PropTypes.node,
|
label: PropTypes.node,
|
||||||
domain: PropTypes.node,
|
domain: PropTypes.node,
|
||||||
|
roleId: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
Badge.defaultProps = {
|
Badge.defaultProps = {
|
||||||
|
@ -329,7 +329,7 @@ class Header extends ImmutablePureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
account.get('roles', []).forEach((role) => {
|
account.get('roles', []).forEach((role) => {
|
||||||
badges.push(<Badge key={`role-badge-${role.get('id')}`} label={<span>{role.get('name')}</span>} domain={domain} />);
|
badges.push(<Badge key={`role-badge-${role.get('id')}`} label={<span>{role.get('name')}</span>} domain={domain} roleId={role.get('id')} />);
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user