您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

DemoteToVisitorDialog.tsx 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import React, { useCallback } from 'react';
  2. import { useDispatch } from 'react-redux';
  3. import ConfirmDialog from '../../../base/dialog/components/native/ConfirmDialog';
  4. import { DialogProps } from '../../../base/dialog/constants';
  5. import { demoteRequest } from '../../../visitors/actions';
  6. interface IProps extends DialogProps {
  7. /**
  8. * The ID of the remote participant to be demoted.
  9. */
  10. participantID: string;
  11. }
  12. /**
  13. * Dialog to confirm a remote participant demote to visitor action.
  14. *
  15. * @returns {JSX.Element}
  16. */
  17. export default function DemoteToVisitorDialog({ participantID }: IProps): JSX.Element {
  18. const dispatch = useDispatch();
  19. const handleSubmit = useCallback(() => {
  20. dispatch(demoteRequest(participantID));
  21. return true; // close dialog
  22. }, [ dispatch, participantID ]);
  23. return (
  24. <ConfirmDialog
  25. cancelLabel = 'dialog.Cancel'
  26. confirmLabel = 'dialog.confirm'
  27. descriptionKey = 'dialog.demoteParticipantDialog'
  28. isConfirmDestructive = { true }
  29. onSubmit = { handleSubmit }
  30. title = 'dialog.demoteParticipantTitle' />
  31. );
  32. }