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.

SettingsButton.tsx 1.4KB

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