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.

DialInSection.tsx 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import React from 'react';
  2. import { useTranslation } from 'react-i18next';
  3. import { useSelector } from 'react-redux';
  4. import { makeStyles } from 'tss-react/mui';
  5. import { IReduxState } from '../../../../app/types';
  6. import { withPixelLineHeight } from '../../../../base/styles/functions.web';
  7. import { getDialInfoPageURL, hasMultipleNumbers } from '../../../functions';
  8. import DialInNumber from './DialInNumber';
  9. interface IProps {
  10. /**
  11. * The phone number to dial to begin the process of dialing into a
  12. * conference.
  13. */
  14. phoneNumber: string;
  15. }
  16. const useStyles = makeStyles()(theme => {
  17. return {
  18. container: {
  19. '& .info-label': {
  20. ...withPixelLineHeight(theme.typography.bodyLongBold)
  21. }
  22. },
  23. link: {
  24. ...withPixelLineHeight(theme.typography.bodyLongRegular),
  25. color: theme.palette.link01,
  26. '&:hover': {
  27. color: theme.palette.link01Hover
  28. }
  29. }
  30. };
  31. });
  32. /**
  33. * Returns a ReactElement for showing how to dial into the conference, if
  34. * dialing in is available.
  35. *
  36. * @private
  37. * @returns {null|ReactElement}
  38. */
  39. function DialInSection({
  40. phoneNumber
  41. }: IProps) {
  42. const { classes, cx } = useStyles();
  43. const conferenceID = useSelector((state: IReduxState) => state['features/invite'].conferenceID);
  44. const dialInfoPageUrl: string = useSelector(getDialInfoPageURL);
  45. const showMoreNumbers = useSelector((state: IReduxState) => hasMultipleNumbers(state['features/invite'].numbers));
  46. const { t } = useTranslation();
  47. return (
  48. <div className = { classes.container }>
  49. <DialInNumber
  50. conferenceID = { conferenceID ?? '' }
  51. phoneNumber = { phoneNumber } />
  52. {showMoreNumbers ? <a
  53. className = { cx('more-numbers', classes.link) }
  54. href = { dialInfoPageUrl }
  55. rel = 'noopener noreferrer'
  56. target = '_blank'>
  57. { t('info.moreNumbers') }
  58. </a> : null}
  59. </div>
  60. );
  61. }
  62. export default DialInSection;