2023-03-02 11:40:36 -08:00
|
|
|
import React from 'react';
|
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
|
|
2023-03-14 12:58:11 -07:00
|
|
|
import { HStack, Icon, Popover, Stack, Text } from 'soapbox/components/ui';
|
2023-03-02 11:40:36 -08:00
|
|
|
import { Group } from 'soapbox/types/entities';
|
|
|
|
|
|
|
|
interface IGroupPolicy {
|
|
|
|
group: Group
|
|
|
|
}
|
|
|
|
|
|
|
|
const GroupPrivacy = ({ group }: IGroupPolicy) => (
|
2023-03-14 12:58:11 -07:00
|
|
|
<Popover
|
2023-03-28 12:37:35 -07:00
|
|
|
referenceElementClassName='cursor-help'
|
2023-03-14 12:58:11 -07:00
|
|
|
content={
|
|
|
|
<Stack space={4} alignItems='center' className='w-72'>
|
|
|
|
<div className='rounded-full bg-gray-200 p-3 dark:bg-gray-800'>
|
|
|
|
<Icon
|
|
|
|
src={
|
|
|
|
group.locked
|
|
|
|
? require('@tabler/icons/lock.svg')
|
|
|
|
: require('@tabler/icons/world.svg')
|
|
|
|
}
|
|
|
|
className='h-6 w-6 text-gray-600 dark:text-gray-600'
|
|
|
|
/>
|
|
|
|
</div>
|
2023-03-02 11:40:36 -08:00
|
|
|
|
2023-03-14 12:58:11 -07:00
|
|
|
<Stack space={1} alignItems='center'>
|
|
|
|
<Text size='lg' weight='bold' align='center'>
|
|
|
|
{group.locked ? (
|
|
|
|
<FormattedMessage id='group.privacy.locked.full' defaultMessage='Private Group' />
|
|
|
|
) : (
|
|
|
|
<FormattedMessage id='group.privacy.public.full' defaultMessage='Public Group' />
|
|
|
|
)}
|
|
|
|
</Text>
|
|
|
|
|
|
|
|
<Text theme='muted' align='center'>
|
|
|
|
{group.locked ? (
|
|
|
|
<FormattedMessage id='group.privacy.locked.info' defaultMessage='Discoverable. Users can join after their request is approved.' />
|
|
|
|
) : (
|
|
|
|
<FormattedMessage id='group.privacy.public.info' defaultMessage='Discoverable. Anyone can join.' />
|
|
|
|
)}
|
|
|
|
</Text>
|
|
|
|
</Stack>
|
|
|
|
</Stack>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<HStack space={1} alignItems='center' data-testid='group-privacy'>
|
|
|
|
<Icon
|
|
|
|
className='h-4 w-4'
|
|
|
|
src={
|
|
|
|
group.locked
|
|
|
|
? require('@tabler/icons/lock.svg')
|
|
|
|
: require('@tabler/icons/world.svg')
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Text theme='inherit' tag='span' size='sm' weight='medium'>
|
|
|
|
{group.locked ? (
|
|
|
|
<FormattedMessage id='group.privacy.locked' defaultMessage='Private' />
|
|
|
|
) : (
|
|
|
|
<FormattedMessage id='group.privacy.public' defaultMessage='Public' />
|
|
|
|
)}
|
|
|
|
</Text>
|
|
|
|
</HStack>
|
|
|
|
</Popover>
|
2023-03-02 11:40:36 -08:00
|
|
|
);
|
|
|
|
|
|
|
|
export default GroupPrivacy;
|