2022-07-18 13:16:08 +00:00
|
|
|
/* eslint-disable lines-around-comment */
|
2022-10-11 10:47:54 +00:00
|
|
|
import { IState } from '../../../app/types';
|
|
|
|
import { CAR_MODE_ENABLED } from '../../../base/flags/constants';
|
|
|
|
import { getFeatureFlag } from '../../../base/flags/functions';
|
2022-08-08 09:36:06 +00:00
|
|
|
import { translate } from '../../../base/i18n/functions';
|
2022-09-06 17:32:20 +00:00
|
|
|
import { IconCar } from '../../../base/icons/svg';
|
2022-07-18 13:16:08 +00:00
|
|
|
import { connect } from '../../../base/redux/functions';
|
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
|
|
|
|
import { navigate }
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
import { screen } from '../../../mobile/navigation/routes';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements an {@link AbstractButton} to open the carmode.
|
|
|
|
*/
|
|
|
|
class OpenCarmodeButton extends AbstractButton<AbstractButtonProps, any, any> {
|
|
|
|
accessibilityLabel = 'toolbar.accessibilityLabel.carmode';
|
|
|
|
icon = IconCar;
|
|
|
|
label = 'carmode.labels.buttonLabel';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles clicking / pressing the button, and opens the carmode mode.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_handleClick() {
|
|
|
|
return navigate(screen.conference.carmode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps part of the Redux state to the props of this component.
|
|
|
|
*
|
2022-10-11 10:47:54 +00:00
|
|
|
* @param {IState} state - The Redux state.
|
2022-05-06 10:14:10 +00:00
|
|
|
* @param {AbstractButtonProps} ownProps - The properties explicitly passed to the component instance.
|
|
|
|
* @private
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
2022-10-11 10:47:54 +00:00
|
|
|
function _mapStateToProps(state: IState, ownProps: AbstractButtonProps): Object {
|
2022-05-06 10:14:10 +00:00
|
|
|
const enabled = getFeatureFlag(state, CAR_MODE_ENABLED, true);
|
|
|
|
const { visible = enabled } = ownProps;
|
|
|
|
|
|
|
|
return {
|
|
|
|
visible
|
|
|
|
};
|
|
|
|
}
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
export default translate(connect(_mapStateToProps)(OpenCarmodeButton));
|