+ ),
+ ({ onChange, settings }) => (
+
-
-
-
+
-
+
- );
- }
-
- navigateTo = (e) =>
- this.setState({ currentIndex: +e.currentTarget.getAttribute('data-mastodon-navigation_index') });
+ ),
+ ];
render () {
+ const { pages } = this;
+ const { index, intl, onChange, settings } = this.props;
+ const CurrentPage = pages[index] || pages[0];
- const { General, CollapsedStatuses, Media, navigateTo } = this;
- const { onClose } = this.props;
- const { currentIndex } = this.state;
-
- return (
-
-
-
-
-
- {
- [
- ,
- ,
- ,
- ][currentIndex] ||
- }
-
-
-
- );
+ return
;
}
}
diff --git a/app/javascript/glitch/components/settings/item.js b/app/javascript/glitch/components/local_settings/page/item/index.js
similarity index 57%
rename from app/javascript/glitch/components/settings/item.js
rename to app/javascript/glitch/components/local_settings/page/item/index.js
index 4c67cc2acf..326c7eeb04 100644
--- a/app/javascript/glitch/components/settings/item.js
+++ b/app/javascript/glitch/components/local_settings/page/item/index.js
@@ -1,30 +1,38 @@
-// Package imports //
+// Package imports
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
-export default class SettingsItem extends React.PureComponent {
+// Stylesheet imports
+import './style';
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+export default class LocalSettingsPageItem extends React.PureComponent {
static propTypes = {
- settings: ImmutablePropTypes.map.isRequired,
- item: PropTypes.array.isRequired,
- id: PropTypes.string.isRequired,
- options: PropTypes.arrayOf(PropTypes.shape({
- value: PropTypes.string.isRequired,
- message: PropTypes.object.isRequired,
- })),
+ children: PropTypes.element.isRequired,
dependsOn: PropTypes.array,
dependsOnNot: PropTypes.array,
- children: PropTypes.element.isRequired,
+ id: PropTypes.string.isRequired,
+ item: PropTypes.array.isRequired,
onChange: PropTypes.func.isRequired,
+ options: PropTypes.arrayOf(PropTypes.shape({
+ value: PropTypes.string.isRequired,
+ message: PropTypes.string.isRequired,
+ })),
+ settings: ImmutablePropTypes.map.isRequired,
};
- handleChange = (e) => {
- const { item, onChange } = this.props;
- onChange(item, e);
+ handleChange = e => {
+ const { target } = e;
+ const { item, onChange, options } = this.props;
+ if (options && options.length > 0) onChange(item, target.value);
+ else onChange(item, target.checked);
}
render () {
+ const { handleChange } = this;
const { settings, item, id, options, children, dependsOn, dependsOnNot } = this.props;
let enabled = true;
@@ -42,38 +50,41 @@ export default class SettingsItem extends React.PureComponent {
if (options && options.length > 0) {
const currentValue = settings.getIn(item);
const optionElems = options && options.length > 0 && options.map((opt) => (
-
));
return (
-