<commit_before>// @flow

import React from 'react';

import { translate } from '../../../base/i18n';
import { Icon, IconInviteMore } from '../../../base/icons';
import { getParticipantCount } from '../../../base/participants';
import { connect } from '../../../base/redux';
import { beginAddPeople } from '../../../invite';
import { isToolboxVisible } from '../../../toolbox';

declare var interfaceConfig: Object;

type Props = {

    /**
     * Whether tile view is enabled.
     */
    _tileViewEnabled: Boolean,

    /**
     * Whether to show the option to invite more people
     * instead of the subject.
     */
    _visible: boolean,

    /**
     * Handler to open the invite dialog.
     */
    onClick: Function,

    /**
     * Invoked to obtain translated strings.
     */
    t: Function
}

/**
 * Represents a replacement for the subject, prompting the
 * sole participant to invite more participants.
 *
 * @param {Object} props - The props of the component.
 * @returns {React$Element<any>}
 */
function InviteMore({
    _tileViewEnabled,
    _visible,
    onClick,
    t
}: Props) {
    return (
        _visible
            ? <div className = { `invite-more-container${_tileViewEnabled ? ' elevated' : ''}` }>
                <div className = 'invite-more-header'>
                    {t('addPeople.inviteMoreHeader')}
                </div>
                <div
                    className = 'invite-more-button'
                    onClick = { onClick }>
                    <Icon src = { IconInviteMore } />
                    <div className = 'invite-more-button-text'>
                        {t('addPeople.inviteMorePrompt')}
                    </div>
                </div>
            </div> : null
    );
}

/**
 * Maps (parts of) the Redux state to the associated
 * {@code Subject}'s props.
 *
 * @param {Object} state - The Redux state.
 * @private
 * @returns {Props}
 */
function mapStateToProps(state) {
    const participantCount = getParticipantCount(state);
    const isAlone = participantCount === 1;
    const hide = interfaceConfig.HIDE_INVITE_MORE_HEADER;

    return {
        _tileViewEnabled: state['features/video-layout'].tileViewEnabled,
        _visible: isToolboxVisible(state) && isAlone && !hide
    };
}

/**
 * Maps dispatching of some action to React component props.
 *
 * @param {Function} dispatch - Redux action dispatcher.
 * @returns {Props}
 */
const mapDispatchToProps = {<commit_msg>feat: Hide Invite more when invite button is disabled.<commit_after>// @flow

import React from 'react';

import { translate } from '../../../base/i18n';
import { Icon, IconInviteMore } from '../../../base/icons';
import { getParticipantCount } from '../../../base/participants';
import { connect } from '../../../base/redux';
import { beginAddPeople } from '../../../invite';
import {
    isButtonEnabled,
    isToolboxVisible
} from '../../../toolbox';

declare var interfaceConfig: Object;

type Props = {

    /**
     * Whether tile view is enabled.
     */
    _tileViewEnabled: Boolean,

    /**
     * Whether to show the option to invite more people
     * instead of the subject.
     */
    _visible: boolean,

    /**
     * Handler to open the invite dialog.
     */
    onClick: Function,

    /**
     * Invoked to obtain translated strings.
     */
    t: Function
}

/**
 * Represents a replacement for the subject, prompting the
 * sole participant to invite more participants.
 *
 * @param {Object} props - The props of the component.
 * @returns {React$Element<any>}
 */
function InviteMore({
    _tileViewEnabled,
    _visible,
    onClick,
    t
}: Props) {
    return (
        _visible
            ? <div className = { `invite-more-container${_tileViewEnabled ? ' elevated' : ''}` }>
                <div className = 'invite-more-header'>
                    {t('addPeople.inviteMoreHeader')}
                </div>
                <div
                    className = 'invite-more-button'
                    onClick = { onClick }>
                    <Icon src = { IconInviteMore } />
                    <div className = 'invite-more-button-text'>
                        {t('addPeople.inviteMorePrompt')}
                    </div>
                </div>
            </div> : null
    );
}

/**
 * Maps (parts of) the Redux state to the associated
 * {@code Subject}'s props.
 *
 * @param {Object} state - The Redux state.
 * @private
 * @returns {Props}
 */
function mapStateToProps(state) {
    const participantCount = getParticipantCount(state);
    const isAlone = participantCount === 1;
    const hide = interfaceConfig.HIDE_INVITE_MORE_HEADER;

    return {
        _tileViewEnabled: state['features/video-layout'].tileViewEnabled,
        _visible: isToolboxVisible(state) && isButtonEnabled('invite') && isAlone && !hide
    };
}

/**
 * Maps dispatching of some action to React component props.
 *
 * @param {Function} dispatch - Redux action dispatcher.
 * @returns {Props}
 */
const mapDispatchToProps = {
{'fraction_non_alphanumeric': 0.13588152891735042, 'fraction_numerical': 0.0012007204322593557, 'mean_word_length': 2.114018691588785, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6341649', 'n_tokens_mistral': 1439, 'n_tokens_neox': 1403, 'n_words': 392}