// @flow import React from 'react'; import { Text, View, TouchableOpacity, TextInput } from 'react-native'; import { translate } from '../../../base/i18n'; import JitsiScreen from '../../../base/modal/components/JitsiScreen'; import { LoadingIndicator } from '../../../base/react'; import { connect } from '../../../base/redux'; import { ASPECT_RATIO_NARROW } from '../../../base/responsive-ui'; import BaseTheme from '../../../base/ui/components/BaseTheme'; import InviteButton from '../../../invite/components/add-people-dialog/native/InviteButton'; import { LargeVideo } from '../../../large-video/components'; import { navigate } from '../../../mobile/navigation/components/lobby/LobbyNavigationContainerRef'; import { screen } from '../../../mobile/navigation/routes'; import AudioMuteButton from '../../../toolbox/components/AudioMuteButton'; import VideoMuteButton from '../../../toolbox/components/VideoMuteButton'; import AbstractLobbyScreen, { Props as AbstractProps, _mapStateToProps as abstractMapStateToProps } from '../AbstractLobbyScreen'; import styles from './styles'; type Props = AbstractProps & { /** * The current aspect ratio of the screen. */ _aspectRatio: Symbol } /** * Implements a waiting screen that represents the participant being in the lobby. */ class LobbyScreen extends AbstractLobbyScreen { /** * Implements {@code PureComponent#render}. * * @inheritdoc */ render() { return ( <> { this._renderLobby() } ); } _getScreenTitleKey: () => string; _onAskToJoin: () => void; _onCancel: () => boolean; _onChangeDisplayName: Object => void; _onChangeEmail: Object => void; _onChangePassword: Object => void; _onEnableEdit: () => void; _onJoinWithPassword: () => void; _onSwitchToKnockMode: () => void; _onSwitchToPasswordMode: () => void; _renderContent: () => React$Element<*>; _renderToolbarButtons: () => React$Element<*>; _renderLobby: () => React$Element<*>; _onNavigateToLobbyChat: () => void; /** * Navigates to the lobby chat screen. * * @private * @returns {void} */ _onNavigateToLobbyChat() { navigate(screen.lobby.chat); } /** * Renders the lobby. * * @inheritdoc */ _renderLobby() { const { _aspectRatio } = this.props; let contentStyles; let largeVideoContainerStyles; let contentContainerStyles; if (_aspectRatio === ASPECT_RATIO_NARROW) { largeVideoContainerStyles = styles.largeVideoContainer; contentContainerStyles = styles.contentContainer; } else { contentStyles = styles.contentWide; largeVideoContainerStyles = styles.largeVideoContainerWide; contentContainerStyles = styles.contentContainerWide; } return ( { this._renderContent() } { this._renderToolbarButtons() } ); } /** * Renders the joining (waiting) fragment of the screen. * * @inheritdoc */ _renderJoining() { return ( { this.props.t('lobby.joiningMessage') } { this._renderStandardButtons() } ); } /** * Renders the participant form to let the knocking participant enter its details. * * @inheritdoc */ _renderParticipantForm() { const { t } = this.props; const { displayName } = this.state; return ( { t('lobby.nameField') } ); } /** * Renders the participant info fragment when we have all the required details of the user. * * @inheritdoc */ _renderParticipantInfo() { return this._renderParticipantForm(); } /** * Renders the password form to let the participant join by using a password instead of knocking. * * @inheritdoc */ _renderPasswordForm() { const { _passwordJoinFailed, t } = this.props; return ( { this.props.t('lobby.passwordField') } { _passwordJoinFailed && { t('lobby.invalidPassword') } } ); } /** * Renders the password join button (set). * * @inheritdoc */ _renderPasswordJoinButtons() { const { t } = this.props; return ( { t('lobby.backToKnockModeButton') } { t('lobby.passwordJoinButton') } ); } /** * Renders the toolbar buttons menu. * * @inheritdoc */ _renderToolbarButtons() { const { _aspectRatio } = this.props; let toolboxContainerStyles; if (_aspectRatio === ASPECT_RATIO_NARROW) { toolboxContainerStyles = styles.toolboxContainer; } else { toolboxContainerStyles = styles.toolboxContainerWide; } return ( ); } /** * Renders the standard button set. * * @inheritdoc */ _renderStandardButtons() { const { _knocking, _renderPassword, _isLobbyChatActive, t } = this.props; const { displayName } = this.state; const askToJoinButtonStyles = displayName ? styles.primaryButton : styles.primaryButtonDisabled; return ( { _knocking && _isLobbyChatActive && { t('toolbar.openChat') } } { _knocking || { t('lobby.knockButton') } } { _renderPassword && { t('lobby.enterPasswordButton') } } { t('dialog.Cancel') } ); } } /** * Maps part of the Redux state to the props of this component. * * @param {Object} state - The Redux state. * @param {Props} ownProps - The own props of the component. * @returns {{ * _aspectRatio: Symbol * }} */ function _mapStateToProps(state: Object, ownProps: Props) { return { ...abstractMapStateToProps(state, ownProps), _aspectRatio: state['features/base/responsive-ui'].aspectRatio }; } export default translate(connect(_mapStateToProps)(LobbyScreen));