Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

SettingsButton.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // @flow
  2. import { createToolbarEvent, sendAnalytics } from '../../../analytics';
  3. import { translate } from '../../../base/i18n';
  4. import { IconSettings } from '../../../base/icons';
  5. import { connect } from '../../../base/redux';
  6. import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
  7. import { openSettingsDialog } from '../../actions';
  8. import { SETTINGS_TABS } from '../../constants';
  9. /**
  10. * The type of the React {@code Component} props of {@link SettingsButton}.
  11. */
  12. type Props = AbstractButtonProps & {
  13. /**
  14. * The default tab at which the settings dialog will be opened.
  15. */
  16. defaultTab: string,
  17. /**
  18. * The redux {@code dispatch} function.
  19. */
  20. dispatch: Function
  21. };
  22. /**
  23. * An abstract implementation of a button for accessing settings.
  24. */
  25. class SettingsButton extends AbstractButton<Props, *> {
  26. accessibilityLabel = 'toolbar.accessibilityLabel.Settings';
  27. icon = IconSettings;
  28. label = 'toolbar.Settings';
  29. tooltip = 'toolbar.Settings';
  30. /**
  31. * Handles clicking / pressing the button, and opens the appropriate dialog.
  32. *
  33. * @protected
  34. * @returns {void}
  35. */
  36. _handleClick() {
  37. const { defaultTab = SETTINGS_TABS.DEVICES, dispatch } = this.props;
  38. sendAnalytics(createToolbarEvent('settings'));
  39. dispatch(openSettingsDialog(defaultTab));
  40. }
  41. }
  42. export default translate(connect()(SettingsButton));