Update variables to use proper naming

This commit is contained in:
Chewbacca 2023-03-28 11:50:56 -04:00
parent 6458ebbb11
commit ca0987dec2

View file

@ -2,6 +2,7 @@ import React from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { HStack, Icon, Text } from 'soapbox/components/ui'; import { HStack, Icon, Text } from 'soapbox/components/ui';
import { GroupRoles } from 'soapbox/schemas/group-member';
import { Group } from 'soapbox/types/entities'; import { Group } from 'soapbox/types/entities';
interface IGroupRelationship { interface IGroupRelationship {
@ -9,10 +10,10 @@ interface IGroupRelationship {
} }
const GroupRelationship = ({ group }: IGroupRelationship) => { const GroupRelationship = ({ group }: IGroupRelationship) => {
const isAdmin = group.relationship?.role === 'admin'; const isOwner = group.relationship?.role === GroupRoles.OWNER;
const isModerator = group.relationship?.role === 'moderator'; const isAdmin = group.relationship?.role === GroupRoles.ADMIN;
if (!isAdmin || !isModerator) { if (!isOwner || !isAdmin) {
return null; return null;
} }
@ -21,14 +22,14 @@ const GroupRelationship = ({ group }: IGroupRelationship) => {
<Icon <Icon
className='h-4 w-4' className='h-4 w-4'
src={ src={
isAdmin isOwner
? require('@tabler/icons/users.svg') ? require('@tabler/icons/users.svg')
: require('@tabler/icons/gavel.svg') : require('@tabler/icons/gavel.svg')
} }
/> />
<Text tag='span' weight='medium' size='sm' theme='inherit'> <Text tag='span' weight='medium' size='sm' theme='inherit'>
{isAdmin {isOwner
? <FormattedMessage id='group.role.admin' defaultMessage='Admin' /> ? <FormattedMessage id='group.role.admin' defaultMessage='Admin' />
: <FormattedMessage id='group.role.moderator' defaultMessage='Moderator' />} : <FormattedMessage id='group.role.moderator' defaultMessage='Moderator' />}
</Text> </Text>