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

OpenCarmodeButton.tsx 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* eslint-disable lines-around-comment */
  2. // @ts-ignore
  3. import { CAR_MODE_ENABLED, getFeatureFlag } from '../../../base/flags';
  4. // @ts-ignore
  5. import { translate } from '../../../base/i18n';
  6. // @ts-ignore
  7. import { IconCar } from '../../../base/icons';
  8. import { connect } from '../../../base/redux/functions';
  9. // @ts-ignore
  10. import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
  11. import { navigate }
  12. // @ts-ignore
  13. from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
  14. // @ts-ignore
  15. import { screen } from '../../../mobile/navigation/routes';
  16. /**
  17. * Implements an {@link AbstractButton} to open the carmode.
  18. */
  19. class OpenCarmodeButton extends AbstractButton<AbstractButtonProps, any, any> {
  20. accessibilityLabel = 'toolbar.accessibilityLabel.carmode';
  21. icon = IconCar;
  22. label = 'carmode.labels.buttonLabel';
  23. /**
  24. * Handles clicking / pressing the button, and opens the carmode mode.
  25. *
  26. * @private
  27. * @returns {void}
  28. */
  29. _handleClick() {
  30. return navigate(screen.conference.carmode);
  31. }
  32. }
  33. /**
  34. * Maps part of the Redux state to the props of this component.
  35. *
  36. * @param {Object} state - The Redux state.
  37. * @param {AbstractButtonProps} ownProps - The properties explicitly passed to the component instance.
  38. * @private
  39. * @returns {Object}
  40. */
  41. function _mapStateToProps(state: Object, ownProps: AbstractButtonProps): Object {
  42. const enabled = getFeatureFlag(state, CAR_MODE_ENABLED, true);
  43. const { visible = enabled } = ownProps;
  44. return {
  45. visible
  46. };
  47. }
  48. // @ts-ignore
  49. export default translate(connect(_mapStateToProps)(OpenCarmodeButton));