diff --git a/app/soapbox/features/ui/components/modals/manage-group-modal/steps/details-step.tsx b/app/soapbox/features/ui/components/modals/manage-group-modal/steps/details-step.tsx index 66b7b4b1d8..cb7dfb4922 100644 --- a/app/soapbox/features/ui/components/modals/manage-group-modal/steps/details-step.tsx +++ b/app/soapbox/features/ui/components/modals/manage-group-modal/steps/details-step.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; -import { Form, FormGroup, Input, Textarea } from 'soapbox/components/ui'; +import { Form, FormGroup, Input, Streamfield, Textarea } from 'soapbox/components/ui'; import AvatarPicker from 'soapbox/features/group/components/group-avatar-picker'; import HeaderPicker from 'soapbox/features/group/components/group-header-picker'; import { useAppSelector, useDebounce, useInstance } from 'soapbox/hooks'; @@ -14,6 +14,7 @@ import type { List as ImmutableList } from 'immutable'; const messages = defineMessages({ groupNamePlaceholder: { id: 'manage_group.fields.name_placeholder', defaultMessage: 'Group Name' }, groupDescriptionPlaceholder: { id: 'manage_group.fields.description_placeholder', defaultMessage: 'Description' }, + hashtagPlaceholder: { id: 'manage_group.fields.hashtag_placeholder', defaultMessage: 'Add a topic' }, }); interface IDetailsStep { @@ -29,6 +30,7 @@ const DetailsStep: React.FC = ({ params, onChange }) => { const { display_name: displayName = '', note = '', + tags = [''], } = params; const debouncedName = debounce(displayName, 300); @@ -63,6 +65,29 @@ const DetailsStep: React.FC = ({ params, onChange }) => { }; }; + const handleTagsChange = (tags: string[]) => { + onChange({ + ...params, + tags, + }); + }; + + const handleAddTag = () => { + onChange({ + ...params, + tags: [...tags, ''], + }); + }; + + const handleRemoveTag = (i: number) => { + const newTags = [...tags]; + newTags.splice(i, 1); + onChange({ + ...params, + tags: newTags, + }); + }; + return (
@@ -95,8 +120,44 @@ const DetailsStep: React.FC = ({ params, onChange }) => { maxLength={Number(instance.configuration.getIn(['groups', 'max_characters_description']))} /> + +
+ [t])} + onChange={handleTagsChange} + onAddItem={handleAddTag} + onRemoveItem={handleRemoveTag} + maxItems={3} + /> +
); }; +interface IHashtagField { + value: string + onChange: (value: string) => void +} + +const HashtagField: React.FC = ({ value, onChange }) => { + const intl = useIntl(); + + const handleChange: React.ChangeEventHandler = ({ target }) => { + onChange(target.value); + }; + + return ( + + ); +}; + export default DetailsStep;