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

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