2019-03-19 15:42:25 +00:00
|
|
|
// @flow
|
2018-10-30 05:02:23 +00:00
|
|
|
|
2017-03-09 00:16:53 +00:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
2019-06-26 14:08:23 +00:00
|
|
|
import { Avatar } from '../../../base/avatar';
|
|
|
|
import { getLocalParticipant } from '../../../base/participants';
|
2019-04-09 11:05:20 +00:00
|
|
|
import { connect } from '../../../base/redux';
|
2017-03-09 00:16:53 +00:00
|
|
|
|
|
|
|
import OverlayFrame from './OverlayFrame';
|
|
|
|
|
|
|
|
/**
|
2018-10-30 05:02:23 +00:00
|
|
|
* The type of the React {@code Component} props of
|
|
|
|
* {@link FilmstripOnlyOverlayFrame}.
|
2017-03-09 00:16:53 +00:00
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
type Props = {
|
|
|
|
|
2017-03-09 00:16:53 +00:00
|
|
|
/**
|
2019-06-26 14:08:23 +00:00
|
|
|
* The ID of the local participant.
|
2017-03-09 00:16:53 +00:00
|
|
|
*/
|
2019-06-26 14:08:23 +00:00
|
|
|
_localParticipantId: string,
|
2017-03-09 00:16:53 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* The children components to be displayed into the overlay frame for
|
|
|
|
* filmstrip only mode.
|
|
|
|
*/
|
|
|
|
children: React$Node,
|
2017-03-09 00:16:53 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* The css class name for the icon that will be displayed over the avatar.
|
|
|
|
*/
|
|
|
|
icon: string,
|
2017-03-09 00:16:53 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* Indicates the css style of the overlay. If true, then lighter; darker,
|
|
|
|
* otherwise.
|
|
|
|
*/
|
|
|
|
isLightOverlay: boolean
|
|
|
|
};
|
2017-03-09 00:16:53 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
|
|
|
* Implements a React Component for the frame of the overlays in filmstrip only
|
|
|
|
* mode.
|
|
|
|
*/
|
|
|
|
class FilmstripOnlyOverlayFrame extends Component<Props> {
|
2017-03-09 00:16:53 +00:00
|
|
|
/**
|
|
|
|
* Renders content related to the icon.
|
|
|
|
*
|
|
|
|
* @returns {ReactElement|null}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
_renderIcon() {
|
|
|
|
if (!this.props.icon) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
const iconClass = `inlay-filmstrip-only__icon ${this.props.icon}`;
|
|
|
|
const iconBGClass = 'inlay-filmstrip-only__icon-background';
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div className = { iconBGClass } />
|
|
|
|
<div className = 'inlay-filmstrip-only__icon-container'>
|
|
|
|
<span className = { iconClass } />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
2017-11-27 22:08:12 +00:00
|
|
|
* @returns {ReactElement}
|
2017-03-09 00:16:53 +00:00
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<OverlayFrame isLightOverlay = { this.props.isLightOverlay }>
|
|
|
|
<div className = 'inlay-filmstrip-only'>
|
|
|
|
<div className = 'inlay-filmstrip-only__content'>
|
|
|
|
{
|
|
|
|
this.props.children
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
<div className = 'inlay-filmstrip-only__avatar-container'>
|
2019-06-26 14:08:23 +00:00
|
|
|
<Avatar participantId = { this.props._localParticipantId } />
|
2017-03-09 00:16:53 +00:00
|
|
|
{
|
|
|
|
this._renderIcon()
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</OverlayFrame>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-04-10 17:59:44 +00:00
|
|
|
* Maps (parts of) the Redux state to the associated FilmstripOnlyOverlayFrame
|
2017-03-09 00:16:53 +00:00
|
|
|
* props.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @private
|
|
|
|
* @returns {{
|
2019-06-26 14:08:23 +00:00
|
|
|
* _localParticipantId: string
|
2017-03-09 00:16:53 +00:00
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
|
|
|
return {
|
2019-06-26 14:08:23 +00:00
|
|
|
_localParticipantId: (getLocalParticipant(state) || {}).id
|
2017-03-09 00:16:53 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-04-10 17:59:44 +00:00
|
|
|
export default connect(_mapStateToProps)(FilmstripOnlyOverlayFrame);
|