diff --git a/app/soapbox/features/developers/settings-store.tsx b/app/soapbox/features/developers/settings-store.tsx index b4dbe9e95..ffd114a52 100644 --- a/app/soapbox/features/developers/settings-store.tsx +++ b/app/soapbox/features/developers/settings-store.tsx @@ -3,10 +3,20 @@ import { useIntl, FormattedMessage, defineMessages } from 'react-intl'; import { showAlertForError } from 'soapbox/actions/alerts'; import { patchMe } from 'soapbox/actions/me'; -import { FE_NAME, SETTINGS_UPDATE } from 'soapbox/actions/settings'; -import { Button, Form, FormActions, FormGroup, Textarea } from 'soapbox/components/ui'; -import Column from 'soapbox/features/ui/components/column'; -import { useAppSelector, useAppDispatch } from 'soapbox/hooks'; +import { FE_NAME, SETTINGS_UPDATE, changeSetting } from 'soapbox/actions/settings'; +import List, { ListItem } from 'soapbox/components/list'; +import { + CardHeader, + CardTitle, + Column, + Button, + Form, + FormActions, + FormGroup, + Textarea, +} from 'soapbox/components/ui'; +import SettingToggle from 'soapbox/features/notifications/components/setting_toggle'; +import { useAppSelector, useAppDispatch, useSettings } from 'soapbox/hooks'; const isJSONValid = (text: any): boolean => { try { @@ -25,6 +35,7 @@ const messages = defineMessages({ const SettingsStore: React.FC = () => { const intl = useIntl(); const dispatch = useAppDispatch(); + const settings = useSettings(); const settingsStore = useAppSelector(state => state.get('settings')); const [rawJSON, setRawJSON] = useState(JSON.stringify(settingsStore, null, 2)); @@ -37,6 +48,10 @@ const SettingsStore: React.FC = () => { setJsonValid(isJSONValid(rawJSON)); }; + const onToggleChange = (key: string[], checked: boolean) => { + dispatch(changeSetting(key, checked, { showAlert: true })); + }; + const handleSubmit: React.FormEventHandler = e => { const settings = JSON.parse(rawJSON); @@ -81,6 +96,52 @@ const SettingsStore: React.FC = () => { + + + + + + + }> + + + + }> + + + + }> + + + + }> + + + + }> + + + +
+ }> + + +
+ + {/* } + hint={} + > + + */} + + } + hint={} + > + + +
); }; diff --git a/app/soapbox/features/preferences/index.tsx b/app/soapbox/features/preferences/index.tsx index 8d8160666..bb81eb773 100644 --- a/app/soapbox/features/preferences/index.tsx +++ b/app/soapbox/features/preferences/index.tsx @@ -157,75 +157,28 @@ const Preferences = () => { /> - {features.privacyScopes && }> - ) => onSelectChange(event, ['defaultPrivacy'])} - /> - } + {features.privacyScopes && ( + }> + ) => onSelectChange(event, ['defaultPrivacy'])} + /> + + )} - {features.richText && }> - ) => onSelectChange(event, ['defaultContentType'])} - /> - } + {features.richText && ( + }> + ) => onSelectChange(event, ['defaultContentType'])} + /> + + )} - {/* - } - onChange={this.onDefaultPrivacyChange} - > - } - hint={} - checked={settings.get('defaultPrivacy') === 'public'} - value='public' - /> - } - hint={} - checked={settings.get('defaultPrivacy') === 'unlisted'} - value='unlisted' - /> - } - hint={} - checked={settings.get('defaultPrivacy') === 'private'} - value='private' - /> - - */} - - {/* {features.richText && ( - - } - onChange={onDefaultContentTypeChange} - > - } - checked={settings.get('defaultContentType') === 'text/plain'} - value='text/plain' - /> - } - hint={} - checked={settings.get('defaultContentType') === 'text/markdown'} - value='text/markdown' - /> - - - )} */} - - {/* }> - - */} - }> @@ -233,10 +186,6 @@ const Preferences = () => { }> - - {/* }> - - */} @@ -248,10 +197,6 @@ const Preferences = () => { } - {/* }> - - */} - }> @@ -259,32 +204,6 @@ const Preferences = () => { }> - - {/* }> - - */} - - {/* }> - - */} - - {/*
- } - path={['dyslexicFont']} - /> -
*/} - {/* } - hint={} - path={['halloween']} - /> */} - {/* } - hint={} - > - - */}
);