闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
2.2 KiB

  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import ImmutablePropTypes from 'react-immutable-proptypes';
  4. import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
  5. import ColumnCollapsable from '../../../components/column_collapsable';
  6. import SettingToggle from '../../notifications/components/setting_toggle';
  7. import SettingText from './setting_text';
  8. const messages = defineMessages({
  9. filter_regex: { id: 'home.column_settings.filter_regex', defaultMessage: 'Filter out by regular expressions' },
  10. settings: { id: 'home.settings', defaultMessage: 'Column settings' }
  11. });
  12. class ColumnSettings extends React.PureComponent {
  13. render () {
  14. const { settings, onChange, onSave, intl } = this.props;
  15. return (
  16. <ColumnCollapsable icon='sliders' title={intl.formatMessage(messages.settings)} fullHeight={209} onCollapse={onSave}>
  17. <div className='column-settings__outer'>
  18. <span className='column-settings__section'><FormattedMessage id='home.column_settings.basic' defaultMessage='Basic' /></span>
  19. <div className='column-settings__row'>
  20. <SettingToggle settings={settings} settingKey={['shows', 'reblog']} onChange={onChange} label={<FormattedMessage id='home.column_settings.show_reblogs' defaultMessage='Show boosts' />} />
  21. </div>
  22. <div className='column-settings__row'>
  23. <SettingToggle settings={settings} settingKey={['shows', 'reply']} onChange={onChange} label={<FormattedMessage id='home.column_settings.show_replies' defaultMessage='Show replies' />} />
  24. </div>
  25. <span className='column-settings__section'><FormattedMessage id='home.column_settings.advanced' defaultMessage='Advanced' /></span>
  26. <div className='column-settings__row'>
  27. <SettingText settings={settings} settingKey={['regex', 'body']} onChange={onChange} label={intl.formatMessage(messages.filter_regex)} />
  28. </div>
  29. </div>
  30. </ColumnCollapsable>
  31. );
  32. }
  33. }
  34. ColumnSettings.propTypes = {
  35. settings: ImmutablePropTypes.map.isRequired,
  36. onChange: PropTypes.func.isRequired,
  37. onSave: PropTypes.func.isRequired,
  38. intl: PropTypes.object.isRequired
  39. }
  40. export default injectIntl(ColumnSettings);