"Fossies" - the Fresh Open Source Software Archive

Member "jitsi-meet-7305/react/features/toolbox/components/native/OpenCarmodeButton.tsx" (26 May 2023, 1671 Bytes) of package /linux/misc/jitsi-meet-7305.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TSX (TypeScript with React) source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "OpenCarmodeButton.tsx": jitsi-meet_8319_vs_jitsi-meet_8615.

    1 import { connect } from 'react-redux';
    2 
    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     from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
   11 import { screen } from '../../../mobile/navigation/routes';
   12 
   13 /**
   14  * Implements an {@link AbstractButton} to open the carmode.
   15  */
   16 class OpenCarmodeButton extends AbstractButton<AbstractButtonProps> {
   17     accessibilityLabel = 'toolbar.accessibilityLabel.carmode';
   18     icon = IconCar;
   19     label = 'carmode.labels.buttonLabel';
   20 
   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 /**
   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 
   44     return {
   45         visible
   46     };
   47 }
   48 
   49 export default translate(connect(_mapStateToProps)(OpenCarmodeButton));