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.

EmbedMeetingDialog.tsx 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import React from 'react';
  2. import { WithTranslation } from 'react-i18next';
  3. import { connect } from 'react-redux';
  4. import { IReduxState } from '../../app/types';
  5. import CopyButton from '../../base/buttons/CopyButton.web';
  6. import { getInviteURL } from '../../base/connection/functions';
  7. import { translate } from '../../base/i18n/functions';
  8. import Dialog from '../../base/ui/components/web/Dialog';
  9. interface IProps extends WithTranslation {
  10. /**
  11. * The URL of the conference.
  12. */
  13. url: string;
  14. }
  15. /**
  16. * Allow users to embed a jitsi meeting in an iframe.
  17. *
  18. * @returns {React$Element<any>}
  19. */
  20. function EmbedMeeting({ t, url }: IProps) {
  21. /**
  22. * Get the embed code for a jitsi meeting.
  23. *
  24. * @returns {string} The iframe embed code.
  25. */
  26. const getEmbedCode = () =>
  27. `<iframe allow="camera; microphone; fullscreen; display-capture; autoplay" src="${url}"`
  28. + ' style="height: 100%; width: 100%; border: 0px;"></iframe>';
  29. return (
  30. <Dialog
  31. cancel = {{ hidden: true }}
  32. ok = {{ hidden: true }}
  33. titleKey = { 'embedMeeting.title' }>
  34. <div className = 'embed-meeting-dialog'>
  35. <textarea
  36. aria-label = { t('dialog.embedMeeting') }
  37. className = 'embed-meeting-code'
  38. readOnly = { true }
  39. value = { getEmbedCode() } />
  40. <CopyButton
  41. aria-label = { t('addPeople.copyLink') }
  42. className = 'embed-meeting-copy'
  43. displayedText = { t('dialog.copy') }
  44. textOnCopySuccess = { t('dialog.copied') }
  45. textOnHover = { t('dialog.copy') }
  46. textToCopy = { getEmbedCode() } />
  47. </div>
  48. </Dialog>
  49. );
  50. }
  51. const mapStateToProps = (state: IReduxState) => {
  52. return {
  53. url: getInviteURL(state)
  54. };
  55. };
  56. export default translate(connect(mapStateToProps)(EmbedMeeting));