diff --git a/app/soapbox/features/preferences/index.tsx b/app/soapbox/features/preferences/index.tsx index ccbd23498..593978dbc 100644 --- a/app/soapbox/features/preferences/index.tsx +++ b/app/soapbox/features/preferences/index.tsx @@ -8,6 +8,7 @@ import { Form } from 'soapbox/components/ui'; import { SelectDropdown } from 'soapbox/features/forms'; import SettingToggle from 'soapbox/features/notifications/components/setting_toggle'; import { useAppSelector } from 'soapbox/hooks'; +import { getFeatures } from 'soapbox/utils/features'; import ThemeToggle from '../ui/components/theme-toggle'; @@ -80,27 +81,24 @@ const messages = defineMessages({ display_media_default: { id: 'preferences.fields.display_media.default', defaultMessage: 'Hide media marked as sensitive' }, display_media_hide_all: { id: 'preferences.fields.display_media.hide_all', defaultMessage: 'Always hide media' }, display_media_show_all: { id: 'preferences.fields.display_media.show_all', defaultMessage: 'Always show media' }, + privacy_public: { id: 'preferences.options.privacy_public', defaultMessage: 'Public' }, + privacy_unlisted: { id: 'preferences.options.privacy_unlisted', defaultMessage: 'Unlisted' }, + privacy_followers_only: { id: 'preferences.options.privacy_followers_only', defaultMessage: 'Followers-only' }, + content_type_plaintext: { id: 'preferences.options.content_type_plaintext', defaultMessage: 'Plain text' }, + content_type_markdown: { id: 'preferences.options.content_type_markdown', defaultMessage: 'Markdown' }, }); const Preferences = () => { const intl = useIntl(); const dispatch = useDispatch(); - // const features = useAppSelector((state) => getFeatures(state.get('instance'))); + const features = useAppSelector((state) => getFeatures(state.instance)); const settings = useAppSelector((state) => getSettings(state)); const onSelectChange = (event: React.ChangeEvent, path: string[]) => { dispatch(changeSetting(path, event.target.value, intl)); }; - // const onDefaultPrivacyChange = (e) => { - // dispatch(changeSetting(['defaultPrivacy'], e.target.value)); - // } - - // const onDefaultContentTypeChange = (event: React.ChangeEvent) => { - // dispatch(changeSetting(['defaultContentType'], event.target.value)); - // }; - const onToggleChange = (key: string[], checked: boolean) => { dispatch(changeSetting(key, checked, intl)); }; @@ -111,6 +109,17 @@ const Preferences = () => { show_all: intl.formatMessage(messages.display_media_show_all), }), []); + const defaultPrivacyOptions = React.useMemo(() => ({ + public: intl.formatMessage(messages.privacy_public), + unlisted: intl.formatMessage(messages.privacy_unlisted), + private: intl.formatMessage(messages.privacy_followers_only), + }), []); + + const defaultContentTypeOptions = React.useMemo(() => ({ + 'text/plain': intl.formatMessage(messages.content_type_plaintext), + 'text/markdown': intl.formatMessage(messages.content_type_markdown), + }), []); + return (
@@ -149,6 +158,22 @@ const Preferences = () => { onChange={(event: React.ChangeEvent) => onSelectChange(event, ['displayMedia'])} /> + + {features.privacyScopes && }> + ) => onSelectChange(event, ['defaultPrivacy'])} + /> + } + + {features.richText && }> + ) => onSelectChange(event, ['defaultContentType'])} + /> + } {/* @@ -211,10 +236,9 @@ const Preferences = () => { - {/* } - path={['missingDescriptionModal']} - /> */} + {/* }> + + */}