From 0f8819e8a589be823d8b84b1e202f1c9016b0787 Mon Sep 17 00:00:00 2001 From: cwm Date: Fri, 15 Dec 2017 13:53:52 -0600 Subject: [PATCH] add initial list filtering components --- .../components/column_settings.js | 46 +++++++++++++++++++ .../containers/column_settings_container.js | 21 +++++++++ .../glitch/features/list_timeline/index.js | 2 + .../flavours/glitch/reducers/settings.js | 11 +++++ 4 files changed, 80 insertions(+) create mode 100644 app/javascript/flavours/glitch/features/list_timeline/components/column_settings.js create mode 100644 app/javascript/flavours/glitch/features/list_timeline/containers/column_settings_container.js diff --git a/app/javascript/flavours/glitch/features/list_timeline/components/column_settings.js b/app/javascript/flavours/glitch/features/list_timeline/components/column_settings.js new file mode 100644 index 0000000000..5bb586dd89 --- /dev/null +++ b/app/javascript/flavours/glitch/features/list_timeline/components/column_settings.js @@ -0,0 +1,46 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; +import SettingToggle from 'flavours/glitch/features/notifications/components/setting_toggle'; +import SettingText from 'flavours/glitch/components/setting_text'; + +const messages = defineMessages({ + filter_regex: { id: 'list_timeline.column_settings.filter_regex', defaultMessage: 'Filter out by regular expressions' }, + settings: { id: 'list_timeline.settings', defaultMessage: 'Column settings' }, +}); + +@injectIntl +export default class ColumnSettings extends React.PureComponent { + + static propTypes = { + settings: ImmutablePropTypes.map.isRequired, + onChange: PropTypes.func.isRequired, + intl: PropTypes.object.isRequired, + }; + + render () { + const { settings, onChange, intl } = this.props; + + return ( +
+ + +
+ } /> +
+ +
+ } /> +
+ + + +
+ +
+
+ ); + } + +} diff --git a/app/javascript/flavours/glitch/features/list_timeline/containers/column_settings_container.js b/app/javascript/flavours/glitch/features/list_timeline/containers/column_settings_container.js new file mode 100644 index 0000000000..b9e2df0645 --- /dev/null +++ b/app/javascript/flavours/glitch/features/list_timeline/containers/column_settings_container.js @@ -0,0 +1,21 @@ +import { connect } from 'react-redux'; +import ColumnSettings from '../components/column_settings'; +import { changeSetting, saveSettings } from 'flavours/glitch/actions/settings'; + +const mapStateToProps = state => ({ + settings: state.getIn(['settings', 'list_timeline']), +}); + +const mapDispatchToProps = dispatch => ({ + + onChange (key, checked) { + dispatch(changeSetting(['list_timeline', ...key], checked)); + }, + + onSave () { + dispatch(saveSettings()); + }, + +}); + +export default connect(mapStateToProps, mapDispatchToProps)(ColumnSettings); diff --git a/app/javascript/flavours/glitch/features/list_timeline/index.js b/app/javascript/flavours/glitch/features/list_timeline/index.js index bcc752d34f..21b8125659 100644 --- a/app/javascript/flavours/glitch/features/list_timeline/index.js +++ b/app/javascript/flavours/glitch/features/list_timeline/index.js @@ -13,6 +13,7 @@ import { fetchList, deleteList } from 'flavours/glitch/actions/lists'; import { openModal } from 'flavours/glitch/actions/modal'; import MissingIndicator from 'flavours/glitch/components/missing_indicator'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; +import ColumnSettingsContainer from './containers/column_settings_container'; const messages = defineMessages({ deleteMessage: { id: 'confirmations.delete_list.message', defaultMessage: 'Are you sure you want to permanently delete this list?' }, @@ -143,6 +144,7 @@ export default class ListTimeline extends React.PureComponent { pinned={pinned} multiColumn={multiColumn} > +