Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

DemoteToVisitorButton.ts 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { connect } from 'react-redux';
  2. import { IReduxState } from '../../../app/types';
  3. import { openDialog } from '../../../base/dialog/actions';
  4. import { translate } from '../../../base/i18n/functions';
  5. import { IconUsers } from '../../../base/icons/svg';
  6. import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
  7. import DemoteToVisitorDialog from './DemoteToVisitorDialog';
  8. interface IProps extends AbstractButtonProps {
  9. /**
  10. * The ID of the participant that this button is supposed to kick.
  11. */
  12. participantID: string;
  13. }
  14. /**
  15. * Implements a React {@link Component} which displays a button for demoting a participant to visitor.
  16. */
  17. class DemoteToVisitorButton extends AbstractButton<IProps> {
  18. accessibilityLabel = 'videothumbnail.demote';
  19. icon = IconUsers;
  20. label = 'videothumbnail.demote';
  21. /**
  22. * Handles clicking / pressing the button, and demoting the participant.
  23. *
  24. * @private
  25. * @returns {void}
  26. */
  27. _handleClick() {
  28. const { dispatch, participantID } = this.props;
  29. dispatch(openDialog(DemoteToVisitorDialog, { participantID }));
  30. }
  31. }
  32. /**
  33. * Maps part of the Redux state to the props of this component.
  34. *
  35. * @param {Object} state - The Redux state.
  36. * @returns {Props}
  37. */
  38. function _mapStateToProps(state: IReduxState) {
  39. return {
  40. visible: state['features/visitors'].supported
  41. };
  42. }
  43. export default translate(connect(_mapStateToProps)(DemoteToVisitorButton));