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

SettingsButton.tsx 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* eslint-disable lines-around-comment */
  2. import { connect } from 'react-redux';
  3. import { IReduxState } from '../../../../app/types';
  4. import { translate } from '../../../../base/i18n/functions';
  5. import { IconGear } from '../../../../base/icons/svg';
  6. import AbstractButton, { IProps as AbstractButtonProps } from '../../../../base/toolbox/components/AbstractButton';
  7. import { navigate }
  8. // @ts-ignore
  9. from '../../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
  10. // @ts-ignore
  11. import { screen } from '../../../../mobile/navigation/routes';
  12. import { SETTINGS_ENABLED } from '../../../flags/constants';
  13. import { getFeatureFlag } from '../../../flags/functions';
  14. /**
  15. * Implements an {@link AbstractButton} to open the carmode.
  16. */
  17. class SettingsButton extends AbstractButton<AbstractButtonProps> {
  18. accessibilityLabel = 'toolbar.accessibilityLabel.Settings';
  19. icon = IconGear;
  20. label = 'settings.buttonLabel';
  21. /**
  22. * Handles clicking / pressing the button, and opens the carmode mode.
  23. *
  24. * @private
  25. * @returns {void}
  26. */
  27. _handleClick() {
  28. return navigate(screen.settings.main);
  29. }
  30. }
  31. /**
  32. * Maps part of the redux state to the component's props.
  33. *
  34. * @param {IReduxState} state - The Redux state.
  35. * @returns {Object}
  36. */
  37. function _mapStateToProps(state: IReduxState) {
  38. const enabled = getFeatureFlag(state, SETTINGS_ENABLED, true);
  39. return {
  40. visible: enabled
  41. };
  42. }
  43. export default translate(connect(_mapStateToProps)(SettingsButton));