Skip to content

Commit

Permalink
[Glitch] Add the role ID to the badge component
Browse files Browse the repository at this point in the history
Port ec1e770 to glitch-soc

Signed-off-by: Claire <[email protected]>
  • Loading branch information
renchap authored and ClearlyClaire committed Apr 6, 2024
1 parent 777984f commit 576c085
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions app/javascript/flavours/glitch/components/badge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';


export const Badge = ({ icon, label, domain }) => (
<div className='account-role'>
export const Badge = ({ icon, label, domain, roleId }) => (
<div className='account-role' data-account-role-id={roleId}>
{icon}
{label}
{domain && <span className='account-role__domain'>{domain}</span>}
Expand All @@ -19,6 +19,7 @@ Badge.propTypes = {
icon: PropTypes.node,
label: PropTypes.node,
domain: PropTypes.node,
roleId: PropTypes.string
};

Badge.defaultProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ class Header extends ImmutablePureComponent {
}

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 (
Expand Down

0 comments on commit 576c085

Please sign in to comment.