Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
import React from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import { makeStyles } from 'tss-react/mui';
import Icon from '../../../base/icons/components/Icon';
import { IconSubtitles } from '../../../base/icons/svg';
import DisabledReasonTooltip from '../../../base/tooltip/components/DisabledReasonTooltip';
import Button from '../../../base/ui/components/web/Button';
import { isE2EEOnInMeeting } from '../../../e2ee/functions';
import LanguageSelector from '../../../subtitles/components/web/LanguageSelector';
import { ChatTabs } from '../../constants';
import { getFocusedTab } from '../../functions';
// @ts-ignore
import AbstractClosedCaptions, { AbstractProps } from '../AbstractClosedCaptions';
import { SubtitlesMessagesContainer } from './SubtitlesMessagesContainer';
/**
* The styles for the ClosedCaptionsTab component.
*/
const useStyles = makeStyles()(theme => {
return {
subtitlesList: {
display: 'flex',
flexDirection: 'column',
height: '100%',
overflowY: 'auto',
padding: '16px',
flex: 1,
boxSizing: 'border-box',
color: theme.palette.chatMessageText
},
container: {
display: 'flex',
flexDirection: 'column',
height: '100%',
position: 'relative',
overflow: 'hidden'
},
messagesContainer: {
display: 'flex',
flexDirection: 'column',
flex: 1,
overflow: 'hidden'
},
emptyContent: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
height: '100%',
padding: '16px',
boxSizing: 'border-box',
flexDirection: 'column',
gap: '16px',
color: theme.palette.chatMessageText,
textAlign: 'center'
},
emptyIcon: {
width: '100px',
padding: '16px',
'& svg': {
width: '100%',
height: 'auto'
}
},
emptyState: {
...theme.typography.bodyLongBold,
color: theme.palette.chatSenderName
}
};
});
/**
* Component that displays the subtitles history in a scrollable list.
*
* @returns {JSX.Element} - The ClosedCaptionsTab component.
*/
const ClosedCaptionsTab = ({
canStartSubtitles,
filteredSubtitles,
groupedSubtitles,
isButtonPressed,
isTranscribing,
startClosedCaptions
}: AbstractProps): JSX.Element => {
const { classes, theme } = useStyles();
const { t } = useTranslation();
const isVisible = useSelector(getFocusedTab) === ChatTabs.CLOSED_CAPTIONS;
const e2eeEnabled = useSelector(isE2EEOnInMeeting);
if (!isTranscribing) {
if (canStartSubtitles) {
const reason = e2eeEnabled ? t('transcribing.unavailableWithE2EE') : undefined;
return (
<div className = { classes.emptyContent }>
<DisabledReasonTooltip reason = { reason }>
<Button
accessibilityLabel = { t('closedCaptionsTab.startClosedCaptionsButton') }
appearance = 'primary'
description = { reason }
disabled = { isButtonPressed || e2eeEnabled }
labelKey = 'closedCaptionsTab.startClosedCaptionsButton'
onClick = { startClosedCaptions }
size = 'large'
type = 'primary' />
</DisabledReasonTooltip>
</div>
);
}
return (
<div className = { classes.emptyContent }>
<Icon
className = { classes.emptyIcon }
color = { theme.palette.chatEmptyText }
src = { IconSubtitles } />
<span className = { classes.emptyState }>
{ t('closedCaptionsTab.emptyState') }
</span>
</div>
);
}
return (
<div className = { classes.container }>
<LanguageSelector />
<div className = { classes.messagesContainer }>
<SubtitlesMessagesContainer
groups = { groupedSubtitles }
isVisible = { isVisible }
messages = { filteredSubtitles } />
</div>
</div>
);
};
export default AbstractClosedCaptions(ClosedCaptionsTab);