123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- import React, { ReactElement } from 'react';
- import { Text, View } from 'react-native';
- import { connect } from 'react-redux';
-
- import { getConferenceName } from '../../../base/conference/functions';
- import { translate } from '../../../base/i18n/functions';
- import JitsiScreen from '../../../base/modal/components/JitsiScreen';
- import LoadingIndicator from '../../../base/react/components/native/LoadingIndicator';
- import { ASPECT_RATIO_NARROW } from '../../../base/responsive-ui/constants';
- import BaseTheme from '../../../base/ui/components/BaseTheme.native';
- import Button from '../../../base/ui/components/native/Button';
- import Input from '../../../base/ui/components/native/Input';
- import { BUTTON_TYPES } from '../../../base/ui/constants.native';
- import BrandingImageBackground from '../../../dynamic-branding/components/native/BrandingImageBackground';
- import LargeVideo from '../../../large-video/components/LargeVideo.native';
- import { navigate }
- from '../../../mobile/navigation/components/lobby/LobbyNavigationContainerRef';
- import { screen } from '../../../mobile/navigation/routes';
- import { preJoinStyles } from '../../../prejoin/components/native/styles';
- 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,
-
- /**
- * The room name.
- */
- _roomName: string
- }
-
- /**
- * Implements a waiting screen that represents the participant being in the lobby.
- */
- class LobbyScreen extends AbstractLobbyScreen<Props> {
- /**
- * Implements {@code PureComponent#render}.
- *
- * @inheritdoc
- */
- render() {
- const { _aspectRatio, _roomName } = this.props;
- let contentWrapperStyles;
- let contentContainerStyles;
- let largeVideoContainerStyles;
-
- if (_aspectRatio === ASPECT_RATIO_NARROW) {
- contentWrapperStyles = preJoinStyles.contentWrapper;
- largeVideoContainerStyles = preJoinStyles.largeVideoContainer;
- contentContainerStyles = styles.contentContainer;
- } else {
- contentWrapperStyles = preJoinStyles.contentWrapperWide;
- largeVideoContainerStyles = preJoinStyles.largeVideoContainerWide;
- contentContainerStyles = preJoinStyles.contentContainerWide;
- }
-
- return (
- <JitsiScreen
- safeAreaInsets = { [ 'right' ] }
- style = { contentWrapperStyles }>
- <BrandingImageBackground />
- <View style = { largeVideoContainerStyles }>
- <View style = { preJoinStyles.displayRoomNameBackdrop }>
- <Text
- numberOfLines = { 1 }
- style = { preJoinStyles.preJoinRoomName }>
- { _roomName }
- </Text>
- </View>
- <LargeVideo />
- </View>
- <View style = { contentContainerStyles }>
- { this._renderToolbarButtons() }
- { this._renderContent() }
- </View>
- </JitsiScreen>
- );
- }
-
- _getScreenTitleKey: () => string;
-
- _onAskToJoin: () => void;
-
- _onCancel: () => boolean;
-
- _onChangeDisplayName: Object => void;
-
- _onChangeEmail: Object => void;
-
- _onChangePassword: Object => void;
-
- _onEnableEdit: () => void;
-
- _onJoinWithPassword: () => void;
-
- _onSwitchToKnockMode: () => void;
-
- _onSwitchToPasswordMode: () => void;
-
- _renderContent: () => ReactElement;
-
- _renderToolbarButtons: () => ReactElement;
-
- _onNavigateToLobbyChat: () => void;
-
- /**
- * Navigates to the lobby chat screen.
- *
- * @private
- * @returns {void}
- */
- _onNavigateToLobbyChat() {
- navigate(screen.lobby.chat);
- }
-
- /**
- * Renders the joining (waiting) fragment of the screen.
- *
- * @inheritdoc
- */
- _renderJoining() {
- return (
- <View style = { styles.lobbyWaitingFragmentContainer }>
- <Text style = { styles.lobbyTitle }>
- { this.props.t('lobby.joiningTitle') }
- </Text>
- <LoadingIndicator
- color = { BaseTheme.palette.icon01 }
- style = { styles.loadingIndicator } />
- <Text style = { styles.joiningMessage }>
- { this.props.t('lobby.joiningMessage') }
- </Text>
- { this._renderStandardButtons() }
- </View>
- );
- }
-
- /**
- * Renders the participant form to let the knocking participant enter its details.
- *
- * @inheritdoc
- */
- _renderParticipantForm() {
- const { t } = this.props;
- const { displayName } = this.state;
-
- return (
- <Input
- customStyles = {{ input: preJoinStyles.customInput }}
- onChange = { this._onChangeDisplayName }
- placeholder = { t('lobby.nameField') }
- value = { displayName } />
- );
- }
-
- /**
- * 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 (
- <Input
- autoCapitalize = 'none'
- autoCompleteType = 'off'
- customStyles = {{ input: styles.customInput }}
- error = { _passwordJoinFailed }
- onChange = { this._onChangePassword }
- placeholder = { t('lobby.passwordField') }
- secureTextEntry = { true }
- value = { this.state.password } />
- );
- }
-
- /**
- * Renders the password join button (set).
- *
- * @inheritdoc
- */
- _renderPasswordJoinButtons() {
- return (
- <View style = { styles.passwordJoinButtons }>
- <Button
- accessibilityLabel = 'lobby.passwordJoinButton'
- disabled = { !this.state.password }
- labelKey = { 'lobby.passwordJoinButton' }
- onClick = { this._onJoinWithPassword }
- style = { preJoinStyles.joinButton }
- type = { BUTTON_TYPES.PRIMARY } />
- <Button
- accessibilityLabel = 'lobby.backToKnockModeButton'
- labelKey = 'lobby.backToKnockModeButton'
- onClick = { this._onSwitchToKnockMode }
- style = { preJoinStyles.joinButton }
- type = { BUTTON_TYPES.TERTIARY } />
- </View>
- );
- }
-
- /**
- * Renders the toolbar buttons menu.
- *
- * @inheritdoc
- */
- _renderToolbarButtons() {
- return (
- <View style = { preJoinStyles.toolboxContainer }>
- <AudioMuteButton
- styles = { preJoinStyles.buttonStylesBorderless } />
- <VideoMuteButton
- styles = { preJoinStyles.buttonStylesBorderless } />
- </View>
- );
- }
-
- /**
- * Renders the standard button set.
- *
- * @inheritdoc
- */
- _renderStandardButtons() {
- const { _knocking, _renderPassword, _isLobbyChatActive } = this.props;
- const { displayName } = this.state;
-
- return (
- <View style = { styles.formWrapper }>
- {
- _knocking && _isLobbyChatActive
- && <Button
- accessibilityLabel = 'toolbar.openChat'
- labelKey = 'toolbar.openChat'
- onClick = { this._onNavigateToLobbyChat }
- style = { preJoinStyles.joinButton }
- type = { BUTTON_TYPES.PRIMARY } />
- }
- {
- _knocking
- || <Button
- accessibilityLabel = 'lobby.knockButton'
- disabled = { !displayName }
- labelKey = 'lobby.knockButton'
- onClick = { this._onAskToJoin }
- style = { preJoinStyles.joinButton }
- type = { BUTTON_TYPES.PRIMARY } />
- }
- {
- _renderPassword
- && <Button
- accessibilityLabel = 'lobby.enterPasswordButton'
- labelKey = 'lobby.enterPasswordButton'
- onClick = { this._onSwitchToPasswordMode }
- style = { preJoinStyles.joinButton }
- type = { BUTTON_TYPES.PRIMARY } />
- }
- </View>
- );
- }
- }
-
- /**
- * 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,
- _roomName: getConferenceName(state)
- };
- }
-
- export default translate(connect(_mapStateToProps)(LobbyScreen));
|