Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

KickButton.js 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import PropTypes from 'prop-types';
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import { sendAnalyticsEvent } from '../../analytics';
  5. import { translate } from '../../base/i18n';
  6. import { kickParticipant } from '../../base/participants';
  7. import RemoteVideoMenuButton from './RemoteVideoMenuButton';
  8. /**
  9. * Implements a React {@link Component} which displays a button for kicking out
  10. * a participant from the conference.
  11. *
  12. * @extends Component
  13. */
  14. class KickButton extends Component {
  15. /**
  16. * {@code KickButton} component's property types.
  17. *
  18. * @static
  19. */
  20. static propTypes = {
  21. /**
  22. * Invoked to signal the participant with the passed in participantID
  23. * should be removed from the conference.
  24. */
  25. dispatch: PropTypes.func,
  26. /**
  27. * Callback to invoke when {@code KickButton} is clicked.
  28. */
  29. onClick: PropTypes.func,
  30. /**
  31. * The ID of the participant linked to the onClick callback.
  32. */
  33. participantID: PropTypes.string,
  34. /**
  35. * Invoked to obtain translated strings.
  36. */
  37. t: PropTypes.func
  38. };
  39. /**
  40. * Initializes a new {@code KickButton} instance.
  41. *
  42. * @param {Object} props - The read-only React Component props with which
  43. * the new instance is to be initialized.
  44. */
  45. constructor(props) {
  46. super(props);
  47. // Bind event handlers so they are only bound once for every instance.
  48. this._onClick = this._onClick.bind(this);
  49. }
  50. /**
  51. * Implements React's {@link Component#render()}.
  52. *
  53. * @inheritdoc
  54. * @returns {ReactElement}
  55. */
  56. render() {
  57. const { participantID, t } = this.props;
  58. return (
  59. <RemoteVideoMenuButton
  60. buttonText = { t('videothumbnail.kick') }
  61. iconClass = 'icon-kick'
  62. id = { `ejectlink_${participantID}` }
  63. onClick = { this._onClick } />
  64. );
  65. }
  66. /**
  67. * Remove the participant with associated participantID from the conference.
  68. *
  69. * @private
  70. * @returns {void}
  71. */
  72. _onClick() {
  73. const { dispatch, onClick, participantID } = this.props;
  74. sendAnalyticsEvent(
  75. 'remotevideomenu.kick',
  76. {
  77. value: 1,
  78. label: participantID
  79. }
  80. );
  81. dispatch(kickParticipant(participantID));
  82. if (onClick) {
  83. onClick();
  84. }
  85. }
  86. }
  87. export default translate(connect()(KickButton));