您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

OpenCarmodeButton.tsx 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { connect } from 'react-redux';
  2. import { IReduxState } from '../../../app/types';
  3. import { CAR_MODE_ENABLED } from '../../../base/flags/constants';
  4. import { getFeatureFlag } from '../../../base/flags/functions';
  5. import { translate } from '../../../base/i18n/functions';
  6. import { IconCar } from '../../../base/icons/svg';
  7. import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
  8. import { navigate }
  9. from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
  10. import { screen } from '../../../mobile/navigation/routes';
  11. /**
  12. * Implements an {@link AbstractButton} to open the carmode.
  13. */
  14. class OpenCarmodeButton extends AbstractButton<AbstractButtonProps> {
  15. accessibilityLabel = 'toolbar.accessibilityLabel.carmode';
  16. icon = IconCar;
  17. label = 'carmode.labels.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.conference.carmode);
  26. }
  27. }
  28. /**
  29. * Maps part of the Redux state to the props of this component.
  30. *
  31. * @param {IReduxState} state - The Redux state.
  32. * @param {AbstractButtonProps} ownProps - The properties explicitly passed to the component instance.
  33. * @private
  34. * @returns {Object}
  35. */
  36. function _mapStateToProps(state: IReduxState, ownProps: AbstractButtonProps): Object {
  37. const enabled = getFeatureFlag(state, CAR_MODE_ENABLED, true);
  38. const { visible = enabled } = ownProps;
  39. return {
  40. visible
  41. };
  42. }
  43. export default translate(connect(_mapStateToProps)(OpenCarmodeButton));