diff --git a/react/features/base/premeeting/components/web/PreMeetingScreen.tsx b/react/features/base/premeeting/components/web/PreMeetingScreen.tsx index 56ee2f66f4..ff3b829d70 100644 --- a/react/features/base/premeeting/components/web/PreMeetingScreen.tsx +++ b/react/features/base/premeeting/components/web/PreMeetingScreen.tsx @@ -1,5 +1,5 @@ import clsx from 'clsx'; -import React, { ReactNode } from 'react'; +import React, { ReactNode, useEffect, useRef, useState } from 'react'; import { connect } from 'react-redux'; import { makeStyles } from 'tss-react/mui'; @@ -11,6 +11,7 @@ import { isButtonEnabled } from '../../../../toolbox/functions.web'; import { getConferenceName } from '../../../conference/functions'; import { PREMEETING_BUTTONS, THIRD_PARTY_PREJOIN_BUTTONS } from '../../../config/constants'; import { withPixelLineHeight } from '../../../styles/functions.web'; +import Tooltip from '../../../tooltip/components/Tooltip'; import { isPreCallTestEnabled } from '../../functions'; import ConnectionStatus from './ConnectionStatus'; @@ -160,15 +161,20 @@ const useStyles = makeStyles()(theme => { display: 'none' } }, + roomNameContainer: { + width: '100%', + textAlign: 'center', + marginBottom: theme.spacing(4) + }, + roomName: { ...withPixelLineHeight(theme.typography.heading5), color: theme.palette.text01, - marginBottom: theme.spacing(4), + display: 'inline-block', overflow: 'hidden', - textAlign: 'center', textOverflow: 'ellipsis', whiteSpace: 'nowrap', - width: '100%' + maxWidth: '100%', } }; }); @@ -195,6 +201,19 @@ const PreMeetingScreen = ({ backgroundSize: 'cover' } : {}; + const roomNameRef = useRef(null); + const [ isOverflowing, setIsOverflowing ] = useState(false); + + useEffect(() => { + if (roomNameRef.current) { + const element = roomNameRef.current; + const elementStyles = window.getComputedStyle(element); + const elementWidth = Math.floor(parseFloat(elementStyles.width)); + + setIsOverflowing(element.scrollWidth > elementWidth + 1); + } + }, [ _roomName ]); + return (
@@ -206,8 +225,22 @@ const PreMeetingScreen = ({ {title} {_roomName && ( - - {_roomName} + + {isOverflowing ? ( + + + {_roomName} + + + ) : ( + + {_roomName} + + )} )} {children} @@ -259,3 +292,4 @@ function mapStateToProps(state: IReduxState, ownProps: Partial) { } export default connect(mapStateToProps)(PreMeetingScreen); +