import React from 'react'; import { connect } from 'react-redux'; import { translate } from '../../../../base/i18n/functions'; import Icon from '../../../../base/icons/components/Icon'; import { IconArrowDown, IconArrowRight } from '../../../../base/icons/svg'; import Container from '../../../../base/react/components/web/Container'; import Image from '../../../../base/react/components/web/Image'; import LoadingIndicator from '../../../../base/react/components/web/LoadingIndicator'; import Text from '../../../../base/react/components/web/Text'; import Button from '../../../../base/ui/components/web/Button'; import Switch from '../../../../base/ui/components/web/Switch'; import { BUTTON_TYPES } from '../../../../base/ui/constants.web'; import { RECORDING_TYPES } from '../../../constants'; import { getRecordingDurationEstimation } from '../../../functions'; import AbstractStartRecordingDialogContent, { mapStateToProps } from '../AbstractStartRecordingDialogContent'; import { DROPBOX_LOGO, ICON_CLOUD, ICON_INFO, ICON_USERS, LOCAL_RECORDING } from '../styles.web'; const EMPTY_FUNCTION = () => { // empty }; /** * The start recording dialog content for the mobile application. */ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent { /** * Renders the component. * * @protected * @returns {React$Component} */ render() { const _renderRecording = this.props._renderRecording; return ( { _renderRecording && ( <> { this._renderNoIntegrationsContent() } { this._renderFileSharingContent() } { this._renderUploadToTheCloudInfo() } { this._renderIntegrationsContent() } )} { this._renderLocalRecordingContent() } { _renderRecording && <> { this._renderAdvancedOptions() } } ); } /** * Renders the switch for saving the transcription. * * @returns {React$Component} */ _renderAdvancedOptions() { const { selectedRecordingService } = this.props; if (selectedRecordingService !== RECORDING_TYPES.JITSI_REC_SERVICE || !this._canStartTranscribing()) { return null; } const { showAdvancedOptions } = this.state; const { shouldRecordAudioAndVideo, shouldRecordTranscription, t } = this.props; return ( <>
{showAdvancedOptions && ( <>
)} ); } /** * Renders the content in case no integrations were enabled. * * @returns {React$Component} */ _renderNoIntegrationsContent() { if (!this._shouldRenderNoIntegrationsContent()) { return null; } const { _localRecordingAvailable, integrationsEnabled, isValidating, isVpaas, selectedRecordingService, t } = this.props; const switchContent = integrationsEnabled || _localRecordingAvailable ? ( ) : null; const label = isVpaas ? t('recording.serviceDescriptionCloud') : t('recording.serviceDescription'); const jitsiContentRecordingIconContainer = integrationsEnabled || _localRecordingAvailable ? 'jitsi-content-recording-icon-container-with-switch' : 'jitsi-content-recording-icon-container-without-switch'; const contentRecordingClass = isVpaas ? 'cloud-content-recording-icon-container' : jitsiContentRecordingIconContainer; const jitsiRecordingHeaderClass = !isVpaas && 'jitsi-recording-header'; return ( { switchContent } ); } /** * Renders the file recording service sharing options, if enabled. * * @returns {React$Component} */ _renderFileSharingContent() { if (!this._shouldRenderFileSharingContent()) { return null; } const { isValidating, onSharingSettingChanged, sharingSetting, t } = this.props; return ( ); } /** * Renders the info in case recording is uploaded to the cloud. * * @returns {React$Component} */ _renderUploadToTheCloudInfo() { const { _hideStorageWarning, isVpaas, selectedRecordingService, t } = this.props; if (!(isVpaas && selectedRecordingService === RECORDING_TYPES.JITSI_REC_SERVICE) || _hideStorageWarning) { return null; } return ( { t('recording.serviceDescriptionCloudInfo') } ); } /** * Renders a spinner component. * * @returns {React$Component} */ _renderSpinner() { return ( ); } /** * Renders the screen with the account information of a logged in user. * * @returns {React$Component} */ _renderSignOut() { const { spaceLeft, t, userName } = this.props; const duration = getRecordingDurationEstimation(spaceLeft); return ( { t('recording.loggedIn', { userName }) } { t('recording.availableSpace', { spaceLeft, duration }) } ); } /** * Renders the content in case integrations were enabled. * * @protected * @returns {React$Component} */ _renderIntegrationsContent() { if (!this._shouldRenderIntegrationsContent()) { return null; } const { _localRecordingAvailable, fileRecordingsServiceEnabled, isTokenValid, isValidating, selectedRecordingService, t } = this.props; let content = null; let switchContent = null; let labelContent = ( { t('recording.authDropboxText') } ); if (isValidating) { content = this._renderSpinner(); switchContent = ; } else if (isTokenValid) { content = this._renderSignOut(); switchContent = (