Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

AbstractRaisedHandIndicator.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // @flow
  2. import { Component } from 'react';
  3. import { getParticipantById } from '../../base/participants';
  4. export type Props = {
  5. /**
  6. * The participant id who we want to render the raised hand indicator
  7. * for.
  8. */
  9. participantId: string,
  10. /**
  11. * True if the hand is raised for this participant.
  12. */
  13. _raisedHand?: boolean
  14. }
  15. /**
  16. * Implements an abstract class for the RaisedHandIndicator component.
  17. */
  18. export default class AbstractRaisedHandIndicator<P: Props>
  19. extends Component<P> {
  20. /**
  21. * Implements {@code Component#render}.
  22. *
  23. * @inheritdoc
  24. */
  25. render() {
  26. if (!this.props._raisedHand) {
  27. return null;
  28. }
  29. return this._renderIndicator();
  30. }
  31. /**
  32. * Renders the platform specific indicator element.
  33. *
  34. * @returns {React$Element<*>}
  35. */
  36. _renderIndicator: () => React$Element<*>
  37. }
  38. /**
  39. * Maps part of the Redux state to the props of this component.
  40. *
  41. * @param {Object} state - The Redux state.
  42. * @param {Props} ownProps - The own props of the component.
  43. * @returns {Object}
  44. */
  45. export function _mapStateToProps(state: Object, ownProps: Props): Object {
  46. const participant = getParticipantById(state, ownProps.participantId);
  47. return {
  48. _raisedHand: participant && participant.raisedHand
  49. };
  50. }