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.

DialInDialog.tsx 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. import React from 'react';
  2. import { WithTranslation } from 'react-i18next';
  3. import { makeStyles } from 'tss-react/mui';
  4. import { translate } from '../../../../base/i18n/functions';
  5. import Icon from '../../../../base/icons/components/Icon';
  6. import { IconArrowLeft } from '../../../../base/icons/svg';
  7. import Button from '../../../../base/ui/components/web/Button';
  8. import { getCountryCodeFromPhone } from '../../../utils';
  9. import Label from '../Label';
  10. interface IProps extends WithTranslation {
  11. /**
  12. * The number to call in order to join the conference.
  13. */
  14. number: string | null;
  15. /**
  16. * Handler used when clicking the back button.
  17. */
  18. onBack: (e?: React.MouseEvent) => void;
  19. /**
  20. * Click handler for primary button.
  21. */
  22. onPrimaryButtonClick: Function;
  23. /**
  24. * Click handler for the small additional text.
  25. */
  26. onSmallTextClick: (e?: React.MouseEvent) => void;
  27. /**
  28. * Click handler for the text button.
  29. */
  30. onTextButtonClick: (e?: React.MouseEvent) => void;
  31. /**
  32. * The passCode of the conference.
  33. */
  34. passCode?: string | number;
  35. }
  36. const useStyles = makeStyles()(theme => {
  37. return {
  38. dialInDialog: {
  39. textAlign: 'center',
  40. '& .prejoin-dialog-dialin-header': {
  41. alignItems: 'center',
  42. margin: `${theme.spacing(3)} 0 ${theme.spacing(5)} ${theme.spacing(3)}`,
  43. display: 'flex'
  44. },
  45. '& .prejoin-dialog-dialin-icon': {
  46. marginRight: theme.spacing(3)
  47. },
  48. '& .prejoin-dialog-dialin-num': {
  49. background: '#3e474f',
  50. borderRadius: '4px',
  51. display: 'inline-block',
  52. fontSize: '15px',
  53. lineHeight: '24px',
  54. margin: theme.spacing(1),
  55. padding: theme.spacing(2),
  56. userSelect: 'text',
  57. '& .prejoin-dialog-dialin-num-container': {
  58. minHeight: '48px',
  59. margin: `${theme.spacing(2)} 0`
  60. },
  61. '& span': {
  62. userSelect: 'text'
  63. }
  64. },
  65. '& .prejoin-dialog-dialin-link': {
  66. color: '#6FB1EA',
  67. cursor: 'pointer',
  68. display: 'inline-block',
  69. fontSize: '13px',
  70. lineHeight: '20px',
  71. marginBottom: theme.spacing(4)
  72. },
  73. '& .prejoin-dialog-dialin-spaced-label': {
  74. marginBottom: theme.spacing(3),
  75. marginTop: '28px'
  76. },
  77. '& .prejoin-dialog-dialin-btns > div': {
  78. marginBottom: theme.spacing(3)
  79. }
  80. }
  81. };
  82. });
  83. /**
  84. * This component displays the dialog with all the information
  85. * to join a meeting by calling it.
  86. *
  87. * @param {IProps} props - The props of the component.
  88. * @returns {React$Element}
  89. */
  90. function DialinDialog(props: IProps) {
  91. const {
  92. number,
  93. onBack,
  94. onPrimaryButtonClick,
  95. onSmallTextClick,
  96. onTextButtonClick,
  97. passCode,
  98. t
  99. } = props;
  100. const { classes } = useStyles();
  101. const flagClassName = `prejoin-dialog-flag iti-flag ${getCountryCodeFromPhone(
  102. number ?? ''
  103. )}`;
  104. return (
  105. <div className = { classes.dialInDialog }>
  106. <div className = 'prejoin-dialog-dialin-header'>
  107. <Icon
  108. className = 'prejoin-dialog-icon prejoin-dialog-dialin-icon'
  109. onClick = { onBack }
  110. role = 'button'
  111. size = { 24 }
  112. src = { IconArrowLeft } />
  113. <div className = 'prejoin-dialog-title'>
  114. {t('prejoin.dialInMeeting')}
  115. </div>
  116. </div>
  117. <Label number = { 1 }>{ t('prejoin.dialInPin') }</Label>
  118. <div className = 'prejoin-dialog-dialin-num-container'>
  119. <div className = 'prejoin-dialog-dialin-num'>
  120. <div className = { flagClassName } />
  121. <span>{number}</span>
  122. </div>
  123. <div className = 'prejoin-dialog-dialin-num'>{passCode}</div>
  124. </div>
  125. <div>
  126. <span
  127. className = 'prejoin-dialog-dialin-link'
  128. onClick = { onSmallTextClick }>
  129. {t('prejoin.viewAllNumbers')}
  130. </span>
  131. </div>
  132. <div className = 'prejoin-dialog-delimiter' />
  133. <Label
  134. className = 'prejoin-dialog-dialin-spaced-label'
  135. number = { 2 }>
  136. {t('prejoin.connectedWithAudioQ')}
  137. </Label>
  138. <div className = 'prejoin-dialog-dialin-btns'>
  139. <Button
  140. className = 'prejoin-dialog-btn'
  141. fullWidth = { true }
  142. labelKey = 'prejoin.joinMeeting'
  143. onClick = { onPrimaryButtonClick }
  144. type = 'primary' />
  145. <Button
  146. className = 'prejoin-dialog-btn'
  147. fullWidth = { true }
  148. labelKey = 'dialog.Cancel'
  149. onClick = { onTextButtonClick }
  150. type = 'tertiary' />
  151. </div>
  152. </div>
  153. );
  154. }
  155. export default translate(DialinDialog);