From 9365b99ad40b437f050153b2fc53c87de7606374 Mon Sep 17 00:00:00 2001 From: crockwave Date: Mon, 20 Jul 2020 18:18:54 -0500 Subject: [PATCH] Moved settings_checkbox to components primary folder. Created features/configuration. --- .../components/settings_checkbox.js | 2 +- app/soapbox/features/configuration/index.js | 199 ++++++++++++++++++ app/soapbox/features/preferences/index.js | 2 +- 3 files changed, 201 insertions(+), 2 deletions(-) rename app/soapbox/{features/preferences => }/components/settings_checkbox.js (94%) create mode 100644 app/soapbox/features/configuration/index.js diff --git a/app/soapbox/features/preferences/components/settings_checkbox.js b/app/soapbox/components/settings_checkbox.js similarity index 94% rename from app/soapbox/features/preferences/components/settings_checkbox.js rename to app/soapbox/components/settings_checkbox.js index 99132e21a..07c6d4d72 100644 --- a/app/soapbox/features/preferences/components/settings_checkbox.js +++ b/app/soapbox/components/settings_checkbox.js @@ -4,7 +4,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { changeSetting } from 'soapbox/actions/settings'; -import { Checkbox } from '../../forms'; +import { Checkbox } from 'soapbox/features/forms'; const mapStateToProps = state => ({ settings: state.get('settings'), diff --git a/app/soapbox/features/configuration/index.js b/app/soapbox/features/configuration/index.js new file mode 100644 index 000000000..beaab5c25 --- /dev/null +++ b/app/soapbox/features/configuration/index.js @@ -0,0 +1,199 @@ +import React from 'react'; +import { connect } from 'react-redux'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import { changeSetting } from 'soapbox/actions/settings'; +import Column from '../ui/components/column'; +import { + SimpleForm, + FieldsGroup, + RadioGroup, + RadioItem, + SelectDropdown, +} from 'soapbox/features/forms'; +import SettingsCheckbox from 'soapbox/components/settings_checkbox'; + +const languages = { + en: 'English', + ar: 'العربية', + ast: 'Asturianu', + bg: 'Български', + bn: 'বাংলা', + ca: 'Català', + co: 'Corsu', + cs: 'Čeština', + cy: 'Cymraeg', + da: 'Dansk', + de: 'Deutsch', + el: 'Ελληνικά', + eo: 'Esperanto', + es: 'Español', + eu: 'Euskara', + fa: 'فارسی', + fi: 'Suomi', + fr: 'Français', + ga: 'Gaeilge', + gl: 'Galego', + he: 'עברית', + hi: 'हिन्दी', + hr: 'Hrvatski', + hu: 'Magyar', + hy: 'Հայերեն', + id: 'Bahasa Indonesia', + io: 'Ido', + it: 'Italiano', + ja: '日本語', + ka: 'ქართული', + kk: 'Қазақша', + ko: '한국어', + lt: 'Lietuvių', + lv: 'Latviešu', + ml: 'മലയാളം', + ms: 'Bahasa Melayu', + nl: 'Nederlands', + no: 'Norsk', + oc: 'Occitan', + pl: 'Polski', + pt: 'Português', + 'pt-BR': 'Português do Brasil', + ro: 'Română', + ru: 'Русский', + sk: 'Slovenčina', + sl: 'Slovenščina', + sq: 'Shqip', + sr: 'Српски', + 'sr-Latn': 'Srpski (latinica)', + sv: 'Svenska', + ta: 'தமிழ்', + te: 'తెలుగు', + th: 'ไทย', + tr: 'Türkçe', + uk: 'Українська', + zh: '中文', + 'zh-CN': '简体中文', + 'zh-HK': '繁體中文(香港)', + 'zh-TW': '繁體中文(臺灣)', +}; + +const messages = defineMessages({ + heading: { id: 'column.preferences', defaultMessage: 'Preferences' }, +}); + +const mapStateToProps = state => ({ + settings: state.get('settings'), +}); + +export default @connect(mapStateToProps) +@injectIntl +class Preferences extends ImmutablePureComponent { + + static propTypes = { + dispatch: PropTypes.func.isRequired, + intl: PropTypes.object.isRequired, + settings: ImmutablePropTypes.map, + }; + + onSelectChange = path => { + return e => { + this.props.dispatch(changeSetting(path, e.target.value)); + }; + }; + + onDefaultPrivacyChange = e => { + const { dispatch } = this.props; + dispatch(changeSetting(['defaultPrivacy'], e.target.value)); + } + + render() { + const { settings, intl } = this.props; + + return ( + + + + } + items={languages} + defaultValue={settings.get('locale')} + onChange={this.onSelectChange(['locale'])} + /> + + + + } + 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' + /> + + + + + } + path={['unfollowModal']} + /> + } + path={['boostModal']} + /> + } + path={['deleteModal']} + /> + + + + } + path={['autoPlayGif']} + /> + } + path={['expandSpoilers']} + /> + } + path={['reduceMotion']} + /> + } + path={['systemFont']} + /> +
+ } + path={['dyslexicFont']} + /> +
+ } + hint={} + path={['demetricator']} + /> +
+
+
+ ); + } + +} diff --git a/app/soapbox/features/preferences/index.js b/app/soapbox/features/preferences/index.js index 80a49a7b7..beaab5c25 100644 --- a/app/soapbox/features/preferences/index.js +++ b/app/soapbox/features/preferences/index.js @@ -13,7 +13,7 @@ import { RadioItem, SelectDropdown, } from 'soapbox/features/forms'; -import SettingsCheckbox from './components/settings_checkbox'; +import SettingsCheckbox from 'soapbox/components/settings_checkbox'; const languages = { en: 'English',