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.

KickRemoteParticipantDialog.js 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import {
  5. createRemoteVideoMenuButtonEvent,
  6. sendAnalytics
  7. } from '../../../analytics';
  8. import { ConfirmDialog } from '../../../base/dialog';
  9. import { translate } from '../../../base/i18n';
  10. import { kickParticipant } from '../../../base/participants';
  11. type Props = {
  12. /**
  13. * The Redux dispatch function.
  14. */
  15. dispatch: Function,
  16. /**
  17. * The remote participant to be kicked.
  18. */
  19. participant: Object,
  20. /**
  21. * Function to translate i18n labels.
  22. */
  23. t: Function
  24. };
  25. /**
  26. * Dialog to confirm a remote participant kick action.
  27. */
  28. class KickRemoteParticipantDialog extends Component<Props> {
  29. /**
  30. * Initializes a new {@code KickRemoteParticipantDialog} instance.
  31. *
  32. * @inheritdoc
  33. */
  34. constructor(props: Props) {
  35. super(props);
  36. this._onSubmit = this._onSubmit.bind(this);
  37. }
  38. /**
  39. * Implements React's {@link Component#render()}.
  40. *
  41. * @inheritdoc
  42. * @returns {ReactElement}
  43. */
  44. render() {
  45. return (
  46. <ConfirmDialog
  47. contentKey = 'dialog.kickParticipantDialog'
  48. onSubmit = { this._onSubmit } />
  49. );
  50. }
  51. _onSubmit: () => boolean;
  52. /**
  53. * Callback for the confirm button.
  54. *
  55. * @private
  56. * @returns {boolean} - True (to note that the modal should be closed).
  57. */
  58. _onSubmit() {
  59. const { dispatch, participant } = this.props;
  60. sendAnalytics(createRemoteVideoMenuButtonEvent(
  61. 'kick.button',
  62. {
  63. 'participant_id': participant.id
  64. }));
  65. dispatch(kickParticipant(participant.id));
  66. return true;
  67. }
  68. }
  69. export default translate(connect()(KickRemoteParticipantDialog));