您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

DeepLinkingDesktopPage.web.tsx 6.3KB

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