闭社主体 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.

71 lines
3.7 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 './setting_toggle';
  7. const messages = defineMessages({
  8. settings: { id: 'notifications.settings', defaultMessage: 'Column settings' }
  9. });
  10. class ColumnSettings extends React.PureComponent {
  11. render () {
  12. const { settings, intl, onChange, onSave } = this.props;
  13. const alertStr = <FormattedMessage id='notifications.column_settings.alert' defaultMessage='Desktop notifications' />;
  14. const showStr = <FormattedMessage id='notifications.column_settings.show' defaultMessage='Show in column' />;
  15. const soundStr = <FormattedMessage id='notifications.column_settings.sound' defaultMessage='Play sound' />;
  16. return (
  17. <ColumnCollapsable icon='sliders' title={intl.formatMessage(messages.settings)} fullHeight={616} onCollapse={onSave}>
  18. <div className='column-settings__outer'>
  19. <span className='column-settings__section'><FormattedMessage id='notifications.column_settings.follow' defaultMessage='New followers:' /></span>
  20. <div className='column-settings__row'>
  21. <SettingToggle settings={settings} settingKey={['alerts', 'follow']} onChange={onChange} label={alertStr} />
  22. <SettingToggle settings={settings} settingKey={['shows', 'follow']} onChange={onChange} label={showStr} />
  23. <SettingToggle settings={settings} settingKey={['sounds', 'follow']} onChange={onChange} label={soundStr} />
  24. </div>
  25. <span className='column-settings__section'><FormattedMessage id='notifications.column_settings.favourite' defaultMessage='Favourites:' /></span>
  26. <div className='column-settings__row'>
  27. <SettingToggle settings={settings} settingKey={['alerts', 'favourite']} onChange={onChange} label={alertStr} />
  28. <SettingToggle settings={settings} settingKey={['shows', 'favourite']} onChange={onChange} label={showStr} />
  29. <SettingToggle settings={settings} settingKey={['sounds', 'favourite']} onChange={onChange} label={soundStr} />
  30. </div>
  31. <span className='column-settings__section'><FormattedMessage id='notifications.column_settings.mention' defaultMessage='Mentions:' /></span>
  32. <div className='column-settings__row'>
  33. <SettingToggle settings={settings} settingKey={['alerts', 'mention']} onChange={onChange} label={alertStr} />
  34. <SettingToggle settings={settings} settingKey={['shows', 'mention']} onChange={onChange} label={showStr} />
  35. <SettingToggle settings={settings} settingKey={['sounds', 'mention']} onChange={onChange} label={soundStr} />
  36. </div>
  37. <span className='column-settings__section'><FormattedMessage id='notifications.column_settings.reblog' defaultMessage='Boosts:' /></span>
  38. <div className='column-settings__row'>
  39. <SettingToggle settings={settings} settingKey={['alerts', 'reblog']} onChange={onChange} label={alertStr} />
  40. <SettingToggle settings={settings} settingKey={['shows', 'reblog']} onChange={onChange} label={showStr} />
  41. <SettingToggle settings={settings} settingKey={['sounds', 'reblog']} onChange={onChange} label={soundStr} />
  42. </div>
  43. </div>
  44. </ColumnCollapsable>
  45. );
  46. }
  47. }
  48. ColumnSettings.propTypes = {
  49. settings: ImmutablePropTypes.map.isRequired,
  50. onChange: PropTypes.func.isRequired,
  51. onSave: PropTypes.func.isRequired,
  52. intl: PropTypes.shape({
  53. formatMessage: PropTypes.func.isRequired
  54. }).isRequired
  55. };
  56. export default injectIntl(ColumnSettings);