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.

StatusIndicators.js 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import { getLocalParticipant, getParticipantById, PARTICIPANT_ROLE } from '../../../base/participants';
  4. import { connect } from '../../../base/redux';
  5. import { getCurrentLayout, LAYOUTS } from '../../../video-layout';
  6. import AudioMutedIndicator from './AudioMutedIndicator';
  7. import ModeratorIndicator from './ModeratorIndicator';
  8. import VideoMutedIndicator from './VideoMutedIndicator';
  9. declare var interfaceConfig: Object;
  10. /**
  11. * The type of the React {@code Component} props of {@link StatusIndicators}.
  12. */
  13. type Props = {
  14. /**
  15. * The current layout of the filmstrip.
  16. */
  17. _currentLayout: string,
  18. /**
  19. * Indicates if the moderator indicator should be visible or not.
  20. */
  21. _showModeratorIndicator: Boolean,
  22. /**
  23. * Indicates if the audio muted indicator should be visible or not.
  24. */
  25. showAudioMutedIndicator: Boolean,
  26. /**
  27. * Indicates if the video muted indicator should be visible or not.
  28. */
  29. showVideoMutedIndicator: Boolean,
  30. /**
  31. * The ID of the participant for which the status bar is rendered.
  32. */
  33. participantID: String
  34. };
  35. /**
  36. * React {@code Component} for showing the status bar in a thumbnail.
  37. *
  38. * @extends Component
  39. */
  40. class StatusIndicators extends Component<Props> {
  41. /**
  42. * Implements React's {@link Component#render()}.
  43. *
  44. * @inheritdoc
  45. * @returns {ReactElement}
  46. */
  47. render() {
  48. const {
  49. _currentLayout,
  50. _showModeratorIndicator,
  51. showAudioMutedIndicator,
  52. showVideoMutedIndicator
  53. } = this.props;
  54. let tooltipPosition;
  55. switch (_currentLayout) {
  56. case LAYOUTS.TILE_VIEW:
  57. tooltipPosition = 'right';
  58. break;
  59. case LAYOUTS.VERTICAL_FILMSTRIP_VIEW:
  60. tooltipPosition = 'left';
  61. break;
  62. default:
  63. tooltipPosition = 'top';
  64. }
  65. return (
  66. <div>
  67. { showAudioMutedIndicator ? <AudioMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
  68. { showVideoMutedIndicator ? <VideoMutedIndicator tooltipPosition = { tooltipPosition } /> : null }
  69. { _showModeratorIndicator ? <ModeratorIndicator tooltipPosition = { tooltipPosition } /> : null }
  70. </div>
  71. );
  72. }
  73. }
  74. /**
  75. * Maps (parts of) the Redux state to the associated {@code StatusIndicators}'s props.
  76. *
  77. * @param {Object} state - The Redux state.
  78. * @param {Object} ownProps - The own props of the component.
  79. * @private
  80. * @returns {{
  81. * _currentLayout: string,
  82. * _showModeratorIndicator: boolean
  83. * }}
  84. */
  85. function _mapStateToProps(state, ownProps) {
  86. const { participantID } = ownProps;
  87. // Only the local participant won't have id for the time when the conference is not yet joined.
  88. const participant = participantID ? getParticipantById(state, participantID) : getLocalParticipant(state);
  89. return {
  90. _currentLayout: getCurrentLayout(state),
  91. _showModeratorIndicator:
  92. !interfaceConfig.DISABLE_FOCUS_INDICATOR && participant && participant.role === PARTICIPANT_ROLE.MODERATOR
  93. };
  94. }
  95. export default connect(_mapStateToProps)(StatusIndicators);