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.

DeepLinkingDesktopPage.web.tsx 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. import { Theme } from '@mui/material';
  2. import React, { useCallback, useEffect } from 'react';
  3. import { WithTranslation } from 'react-i18next';
  4. import { useDispatch, useSelector } from 'react-redux';
  5. import { makeStyles } from 'tss-react/mui';
  6. import { createDeepLinkingPageEvent } from '../../analytics/AnalyticsEvents';
  7. import { sendAnalytics } from '../../analytics/functions';
  8. import { IReduxState } from '../../app/types';
  9. import { IDeeplinkingConfig } from '../../base/config/configType';
  10. import { getLegalUrls } from '../../base/config/functions.any';
  11. import { isSupportedBrowser } from '../../base/environment/environment';
  12. import { translate, translateToHTML } from '../../base/i18n/functions';
  13. import { withPixelLineHeight } from '../../base/styles/functions.web';
  14. import Button from '../../base/ui/components/web/Button';
  15. import { BUTTON_TYPES } from '../../base/ui/constants.any';
  16. import {
  17. openDesktopApp,
  18. openWebApp
  19. } from '../actions';
  20. import { _TNS } from '../constants';
  21. const useStyles = makeStyles()((theme: Theme) => {
  22. return {
  23. container: {
  24. background: '#1E1E1E',
  25. alignItems: 'center',
  26. justifyContent: 'center',
  27. width: '100%',
  28. height: '100%',
  29. display: 'flex'
  30. },
  31. contentPane: {
  32. display: 'flex',
  33. flexDirection: 'column',
  34. background: theme.palette.ui01,
  35. border: `1px solid ${theme.palette.ui03}`,
  36. padding: 40,
  37. borderRadius: 16,
  38. maxWidth: 410,
  39. color: theme.palette.text01
  40. },
  41. logo: {
  42. marginBottom: 32
  43. },
  44. launchingMeetingLabel: {
  45. marginBottom: 16,
  46. ...withPixelLineHeight(theme.typography.heading4)
  47. },
  48. roomName: {
  49. marginBottom: 32,
  50. ...withPixelLineHeight(theme.typography.heading5)
  51. },
  52. descriptionLabel: {
  53. marginBottom: 32,
  54. ...withPixelLineHeight(theme.typography.bodyLongRegular)
  55. },
  56. buttonsContainer: {
  57. display: 'flex',
  58. justifyContent: 'flex-start',
  59. '& > *:not(:last-child)': {
  60. marginRight: 16
  61. }
  62. },
  63. separator: {
  64. marginTop: 40,
  65. height: 1,
  66. maxWidth: 390,
  67. background: theme.palette.ui03
  68. },
  69. label: {
  70. marginTop: 40,
  71. ...withPixelLineHeight(theme.typography.labelRegular),
  72. color: theme.palette.text02,
  73. '& a': {
  74. color: theme.palette.link01
  75. }
  76. }
  77. };
  78. });
  79. const DeepLinkingDesktopPage: React.FC<WithTranslation> = ({ t }) => {
  80. const dispatch = useDispatch();
  81. const room = useSelector((state: IReduxState) => decodeURIComponent(state['features/base/conference'].room || ''));
  82. const deeplinkingCfg = useSelector((state: IReduxState) =>
  83. state['features/base/config']?.deeplinking || {} as IDeeplinkingConfig);
  84. const legalUrls = useSelector(getLegalUrls);
  85. const { hideLogo, desktop } = deeplinkingCfg;
  86. const { classes: styles } = useStyles();
  87. const onLaunchWeb = useCallback(() => {
  88. sendAnalytics(
  89. createDeepLinkingPageEvent(
  90. 'clicked', 'launchWebButton', { isMobileBrowser: false }));
  91. dispatch(openWebApp());
  92. }, []);
  93. const onTryAgain = useCallback(() => {
  94. sendAnalytics(
  95. createDeepLinkingPageEvent(
  96. 'clicked', 'tryAgainButton', { isMobileBrowser: false }));
  97. dispatch(openDesktopApp());
  98. }, []);
  99. useEffect(() => {
  100. sendAnalytics(
  101. createDeepLinkingPageEvent(
  102. 'displayed', 'DeepLinkingDesktop', { isMobileBrowser: false }));
  103. }, []);
  104. return (
  105. <div className = { styles.container }>
  106. <div className = { styles.contentPane }>
  107. <div className = 'header'>
  108. {
  109. !hideLogo
  110. && <img
  111. alt = { t('welcomepage.logo.logoDeepLinking') }
  112. className = { styles.logo }
  113. src = 'images/logo-deep-linking.png' />
  114. }
  115. </div>
  116. <div className = { styles.launchingMeetingLabel }>
  117. {
  118. t(`${_TNS}.titleNew`)
  119. }
  120. </div>
  121. <div className = { styles.roomName }>{ room }</div>
  122. <div className = { styles.descriptionLabel }>
  123. {
  124. isSupportedBrowser()
  125. ? translateToHTML(t, `${_TNS}.descriptionNew`, { app: desktop?.appName })
  126. : t(`${_TNS}.descriptionWithoutWeb`, { app: desktop?.appName })
  127. }
  128. </div>
  129. <div className = { styles.buttonsContainer }>
  130. <Button
  131. label = { t(`${_TNS}.tryAgainButton`) }
  132. onClick = { onTryAgain } />
  133. { isSupportedBrowser() && (
  134. <Button
  135. label = { t(`${_TNS}.launchWebButton`) }
  136. onClick = { onLaunchWeb }
  137. type = { BUTTON_TYPES.SECONDARY } />
  138. )}
  139. </div>
  140. <div className = { styles.separator } />
  141. <div className = { styles.label }> {translateToHTML(t, 'deepLinking.termsAndConditions', {
  142. termsAndConditionsLink: legalUrls.terms
  143. })}
  144. </div>
  145. </div>
  146. </div>
  147. );
  148. };
  149. export default translate(DeepLinkingDesktopPage);