You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FilmstripOnlyOverlayFrame.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { Avatar } from '../../../base/avatar';
  4. import { getLocalParticipant } from '../../../base/participants';
  5. import { connect } from '../../../base/redux';
  6. import OverlayFrame from './OverlayFrame';
  7. /**
  8. * The type of the React {@code Component} props of
  9. * {@link FilmstripOnlyOverlayFrame}.
  10. */
  11. type Props = {
  12. /**
  13. * The ID of the local participant.
  14. */
  15. _localParticipantId: string,
  16. /**
  17. * The children components to be displayed into the overlay frame for
  18. * filmstrip only mode.
  19. */
  20. children: React$Node,
  21. /**
  22. * The css class name for the icon that will be displayed over the avatar.
  23. */
  24. icon: string,
  25. /**
  26. * Indicates the css style of the overlay. If true, then lighter; darker,
  27. * otherwise.
  28. */
  29. isLightOverlay: boolean
  30. };
  31. /**
  32. * Implements a React Component for the frame of the overlays in filmstrip only
  33. * mode.
  34. */
  35. class FilmstripOnlyOverlayFrame extends Component<Props> {
  36. /**
  37. * Renders content related to the icon.
  38. *
  39. * @returns {ReactElement|null}
  40. * @private
  41. */
  42. _renderIcon() {
  43. if (!this.props.icon) {
  44. return null;
  45. }
  46. const iconClass = `inlay-filmstrip-only__icon ${this.props.icon}`;
  47. const iconBGClass = 'inlay-filmstrip-only__icon-background';
  48. return (
  49. <div>
  50. <div className = { iconBGClass } />
  51. <div className = 'inlay-filmstrip-only__icon-container'>
  52. <span className = { iconClass } />
  53. </div>
  54. </div>
  55. );
  56. }
  57. /**
  58. * Implements React's {@link Component#render()}.
  59. *
  60. * @inheritdoc
  61. * @returns {ReactElement}
  62. */
  63. render() {
  64. return (
  65. <OverlayFrame isLightOverlay = { this.props.isLightOverlay }>
  66. <div className = 'inlay-filmstrip-only'>
  67. <div className = 'inlay-filmstrip-only__content'>
  68. {
  69. this.props.children
  70. }
  71. </div>
  72. <div className = 'inlay-filmstrip-only__avatar-container'>
  73. <Avatar participantId = { this.props._localParticipantId } />
  74. {
  75. this._renderIcon()
  76. }
  77. </div>
  78. </div>
  79. </OverlayFrame>
  80. );
  81. }
  82. }
  83. /**
  84. * Maps (parts of) the Redux state to the associated FilmstripOnlyOverlayFrame
  85. * props.
  86. *
  87. * @param {Object} state - The Redux state.
  88. * @private
  89. * @returns {{
  90. * _localParticipantId: string
  91. * }}
  92. */
  93. function _mapStateToProps(state) {
  94. return {
  95. _localParticipantId: (getLocalParticipant(state) || {}).id
  96. };
  97. }
  98. export default connect(_mapStateToProps)(FilmstripOnlyOverlayFrame);