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';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
|
|
|
import {
|
|
|
|
Avatar,
|
|
|
|
getAvatarURL,
|
|
|
|
getLocalParticipant
|
|
|
|
} from '../../base/participants';
|
|
|
|
|
|
|
|
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
|
|
|
/**
|
2018-10-30 05:02:23 +00:00
|
|
|
* The source (e.g. URI, URL) of the avatar image of the local participant.
|
2017-03-09 00:16:53 +00:00
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
_avatar: 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'>
|
|
|
|
<Avatar uri = { this.props._avatar } />
|
|
|
|
{
|
|
|
|
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 {{
|
|
|
|
* _avatar: string
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
|
|
|
return {
|
2017-05-31 05:32:13 +00:00
|
|
|
_avatar: getAvatarURL(getLocalParticipant(state) || {})
|
2017-03-09 00:16:53 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-03-19 15:42:25 +00:00
|
|
|
// $FlowExpectedError
|
2017-04-10 17:59:44 +00:00
|
|
|
export default connect(_mapStateToProps)(FilmstripOnlyOverlayFrame);
|