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.4KB

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