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.

AllowToggleCameraDialog.tsx 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import React from 'react';
  2. import { WithTranslation } from 'react-i18next';
  3. import { useSelector } from 'react-redux';
  4. import { IReduxState } from '../../../../app/types';
  5. import { translate } from '../../../i18n/functions';
  6. import { getParticipantDisplayName } from '../../../participants/functions';
  7. import Dialog from '../../../ui/components/web/Dialog';
  8. interface IProps extends WithTranslation {
  9. /**
  10. * The participant id of the toggle camera requester.
  11. */
  12. initiatorId: string;
  13. /**
  14. * Function to be invoked after permission to toggle camera granted.
  15. */
  16. onAllow: () => void;
  17. }
  18. /**
  19. * Dialog to allow toggling camera remotely.
  20. *
  21. * @returns {JSX.Element} - The allow toggle camera dialog.
  22. */
  23. const AllowToggleCameraDialog = ({ onAllow, t, initiatorId }: IProps): JSX.Element => {
  24. const initiatorName = useSelector((state: IReduxState) => getParticipantDisplayName(state, initiatorId));
  25. return (
  26. <Dialog
  27. ok = {{ translationKey: 'dialog.allow' }}
  28. onSubmit = { onAllow }
  29. titleKey = 'dialog.allowToggleCameraTitle'>
  30. <div>
  31. { t('dialog.allowToggleCameraDialog', { initiatorName }) }
  32. </div>
  33. </Dialog>
  34. );
  35. };
  36. export default translate(AllowToggleCameraDialog);