snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
59
react/features/overlay/components/web/OverlayContainer.tsx
Normal file
59
react/features/overlay/components/web/OverlayContainer.tsx
Normal file
@@ -0,0 +1,59 @@
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { IReduxState } from '../../../app/types';
|
||||
import { getOverlayToRender } from '../../functions.web';
|
||||
|
||||
|
||||
/**
|
||||
* The type of the React {@link Component} props of {@code OverlayContainer}.
|
||||
*/
|
||||
interface IProps {
|
||||
|
||||
/**
|
||||
* The React {@link Component} type of overlay to be rendered by the
|
||||
* associated {@code OverlayContainer}.
|
||||
*/
|
||||
overlay: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements a React {@link Component} that will display the correct overlay
|
||||
* when needed.
|
||||
*/
|
||||
class OverlayContainer extends Component<IProps> {
|
||||
/**
|
||||
* Implements React's {@link Component#render()}.
|
||||
*
|
||||
* @inheritdoc
|
||||
* @public
|
||||
* @returns {ReactElement|null}
|
||||
*/
|
||||
override render() {
|
||||
const { overlay } = this.props;
|
||||
|
||||
return overlay ? React.createElement(overlay, {}) : null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps (parts of) the redux state to the associated {@code OverlayContainer}'s
|
||||
* props.
|
||||
*
|
||||
* @param {Object} state - The redux state.
|
||||
* @private
|
||||
* @returns {{
|
||||
* overlay: ?Object
|
||||
* }}
|
||||
*/
|
||||
function _mapStateToProps(state: IReduxState) {
|
||||
return {
|
||||
/**
|
||||
* The React {@link Component} type of overlay to be rendered by the
|
||||
* associated {@code OverlayContainer}.
|
||||
*/
|
||||
overlay: getOverlayToRender(state)
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(_mapStateToProps)(OverlayContainer);
|
||||
Reference in New Issue
Block a user