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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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: Function;
  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. '& .prejoin-dialog-dialin-num-container': {
  57. minHeight: '48px',
  58. margin: `${theme.spacing(2)} 0`
  59. }
  60. },
  61. '& .prejoin-dialog-dialin-link': {
  62. color: '#6FB1EA',
  63. cursor: 'pointer',
  64. display: 'inline-block',
  65. fontSize: '13px',
  66. lineHeight: '20px',
  67. marginBottom: theme.spacing(4)
  68. },
  69. '& .prejoin-dialog-dialin-spaced-label': {
  70. marginBottom: theme.spacing(3),
  71. marginTop: '28px'
  72. },
  73. '& .prejoin-dialog-dialin-btns > div': {
  74. marginBottom: theme.spacing(3)
  75. }
  76. }
  77. };
  78. });
  79. /**
  80. * This component displays the dialog with all the information
  81. * to join a meeting by calling it.
  82. *
  83. * @param {IProps} props - The props of the component.
  84. * @returns {React$Element}
  85. */
  86. function DialinDialog(props: IProps) {
  87. const {
  88. number,
  89. onBack,
  90. onPrimaryButtonClick,
  91. onSmallTextClick,
  92. onTextButtonClick,
  93. passCode,
  94. t
  95. } = props;
  96. const { classes } = useStyles();
  97. const flagClassName = `prejoin-dialog-flag iti-flag ${getCountryCodeFromPhone(
  98. number ?? ''
  99. )}`;
  100. return (
  101. <div className = { classes.dialInDialog }>
  102. <div className = 'prejoin-dialog-dialin-header'>
  103. <Icon
  104. className = 'prejoin-dialog-icon prejoin-dialog-dialin-icon'
  105. onClick = { onBack }
  106. role = 'button'
  107. size = { 24 }
  108. src = { IconArrowLeft } />
  109. <div className = 'prejoin-dialog-title'>
  110. {t('prejoin.dialInMeeting')}
  111. </div>
  112. </div>
  113. <Label number = { 1 }>{ t('prejoin.dialInPin') }</Label>
  114. <div className = 'prejoin-dialog-dialin-num-container'>
  115. <div className = 'prejoin-dialog-dialin-num'>
  116. <div className = { flagClassName } />
  117. <span>{number}</span>
  118. </div>
  119. <div className = 'prejoin-dialog-dialin-num'>{passCode}</div>
  120. </div>
  121. <div>
  122. <span
  123. className = 'prejoin-dialog-dialin-link'
  124. onClick = { onSmallTextClick }>
  125. {t('prejoin.viewAllNumbers')}
  126. </span>
  127. </div>
  128. <div className = 'prejoin-dialog-delimiter' />
  129. <Label
  130. className = 'prejoin-dialog-dialin-spaced-label'
  131. number = { 2 }>
  132. {t('prejoin.connectedWithAudioQ')}
  133. </Label>
  134. <div className = 'prejoin-dialog-dialin-btns'>
  135. <Button
  136. className = 'prejoin-dialog-btn'
  137. fullWidth = { true }
  138. labelKey = 'prejoin.joinMeeting'
  139. onClick = { onPrimaryButtonClick }
  140. type = 'primary' />
  141. <Button
  142. className = 'prejoin-dialog-btn'
  143. fullWidth = { true }
  144. labelKey = 'dialog.Cancel'
  145. onClick = { onTextButtonClick }
  146. type = 'tertiary' />
  147. </div>
  148. </div>
  149. );
  150. }
  151. export default translate(DialinDialog);