2022-12-15 14:51:30 -08:00
|
|
|
|
import React from 'react';
|
|
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
|
|
|
2023-05-01 11:58:40 -07:00
|
|
|
|
import { type CreateGroupParams } from 'soapbox/api/hooks';
|
2022-12-15 14:51:30 -08:00
|
|
|
|
import List, { ListItem } from 'soapbox/components/list';
|
|
|
|
|
import { Form, FormGroup, Stack, Text } from 'soapbox/components/ui';
|
|
|
|
|
|
2023-04-03 13:06:20 -07:00
|
|
|
|
interface IPrivacyStep {
|
|
|
|
|
params: CreateGroupParams
|
|
|
|
|
onChange(params: CreateGroupParams): void
|
|
|
|
|
}
|
2022-12-15 14:51:30 -08:00
|
|
|
|
|
2023-04-03 13:06:20 -07:00
|
|
|
|
const PrivacyStep: React.FC<IPrivacyStep> = ({ params, onChange }) => {
|
|
|
|
|
const visibility = params.group_visibility || 'everyone';
|
2022-12-15 14:51:30 -08:00
|
|
|
|
|
2023-04-03 13:06:20 -07:00
|
|
|
|
const onChangePrivacy = (group_visibility: CreateGroupParams['group_visibility']) => {
|
|
|
|
|
onChange({ ...params, group_visibility });
|
2022-12-15 14:51:30 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
2023-03-29 12:42:20 -07:00
|
|
|
|
<Stack className='mx-auto max-w-xs py-10' space={2}>
|
2022-12-15 14:51:30 -08:00
|
|
|
|
<Text size='3xl' weight='bold' align='center'>
|
2023-03-02 10:17:25 -08:00
|
|
|
|
<FormattedMessage id='manage_group.get_started' defaultMessage='Let’s get started!' />
|
2022-12-15 14:51:30 -08:00
|
|
|
|
</Text>
|
2023-03-29 12:42:20 -07:00
|
|
|
|
<Text theme='muted' align='center'>
|
2022-12-15 14:51:30 -08:00
|
|
|
|
<FormattedMessage id='manage_group.tagline' defaultMessage='Groups connect you with others based on shared interests.' />
|
|
|
|
|
</Text>
|
|
|
|
|
</Stack>
|
|
|
|
|
<Form>
|
|
|
|
|
<FormGroup
|
2022-12-16 15:33:07 -08:00
|
|
|
|
labelText={<FormattedMessage id='manage_group.privacy.label' defaultMessage='Privacy settings' />}
|
2022-12-15 14:51:30 -08:00
|
|
|
|
>
|
|
|
|
|
<List>
|
|
|
|
|
<ListItem
|
2023-04-03 09:17:29 -07:00
|
|
|
|
label={<Text weight='medium'><FormattedMessage id='manage_group.privacy.public.label' defaultMessage='Public' /></Text>}
|
2022-12-16 15:33:07 -08:00
|
|
|
|
hint={<FormattedMessage id='manage_group.privacy.public.hint' defaultMessage='Discoverable. Anyone can join.' />}
|
2023-04-03 13:06:20 -07:00
|
|
|
|
onSelect={() => onChangePrivacy('everyone')}
|
|
|
|
|
isSelected={visibility === 'everyone'}
|
2022-12-15 14:51:30 -08:00
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<ListItem
|
2023-04-03 09:17:29 -07:00
|
|
|
|
label={<Text weight='medium'><FormattedMessage id='manage_group.privacy.private.label' defaultMessage='Private (Owner approval required)' /></Text>}
|
2022-12-16 15:33:07 -08:00
|
|
|
|
hint={<FormattedMessage id='manage_group.privacy.private.hint' defaultMessage='Discoverable. Users can join after their request is approved.' />}
|
2023-04-03 13:06:20 -07:00
|
|
|
|
onSelect={() => onChangePrivacy('members_only')}
|
|
|
|
|
isSelected={visibility === 'members_only'}
|
2022-12-15 14:51:30 -08:00
|
|
|
|
/>
|
|
|
|
|
</List>
|
|
|
|
|
</FormGroup>
|
2022-12-16 15:33:07 -08:00
|
|
|
|
<Text size='sm' theme='muted' align='center'>
|
|
|
|
|
<FormattedMessage id='manage_group.privacy.hint' defaultMessage='These settings cannot be changed later.' />
|
|
|
|
|
</Text>
|
2022-12-15 14:51:30 -08:00
|
|
|
|
</Form>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default PrivacyStep;
|