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.

EmbedMeetingDialog.tsx 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. readOnly = { true }
  51. textarea = { true }
  52. value = { getEmbedCode() } />
  53. <CopyButton
  54. aria-label = { t('addPeople.copyLink') }
  55. className = { classes.button }
  56. displayedText = { t('dialog.copy') }
  57. textOnCopySuccess = { t('dialog.copied') }
  58. textOnHover = { t('dialog.copy') }
  59. textToCopy = { getEmbedCode() } />
  60. </div>
  61. </Dialog>
  62. );
  63. }
  64. const mapStateToProps = (state: IReduxState) => {
  65. return {
  66. url: getInviteURL(state)
  67. };
  68. };
  69. export default translate(connect(mapStateToProps)(EmbedMeeting));