Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

OpenCarmodeButton.tsx 1.8KB

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