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

OpenCarmodeButton.tsx 1.6KB

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