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.

OpenCarmodeButton.tsx 1.5KB

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