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

UnsupportedDesktopBrowser.js 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* @flow */
  2. import PropTypes from 'prop-types';
  3. import React, { Component } from 'react';
  4. import { translate } from '../../base/i18n';
  5. import { Platform } from '../../base/react';
  6. import { CHROME, FIREFOX, IE, SAFARI } from './browserLinks';
  7. import HideNotificationBarStyle from './HideNotificationBarStyle';
  8. /**
  9. * The namespace of the CSS styles of UnsupportedDesktopBrowser.
  10. *
  11. * @private
  12. * @type {string}
  13. */
  14. const _SNS = 'unsupported-desktop-browser';
  15. /**
  16. * React component representing unsupported browser page.
  17. *
  18. * @class UnsupportedDesktopBrowser
  19. */
  20. class UnsupportedDesktopBrowser extends Component<*> {
  21. /**
  22. * UnsupportedDesktopBrowser component's property types.
  23. *
  24. * @static
  25. */
  26. static propTypes = {
  27. /**
  28. * The function to translate human-readable text.
  29. *
  30. * @public
  31. * @type {Function}
  32. */
  33. t: PropTypes.func
  34. };
  35. /**
  36. * Renders the component.
  37. *
  38. * @returns {ReactElement}
  39. */
  40. render() {
  41. return (
  42. <div className = { _SNS }>
  43. <h2 className = { `${_SNS}__title` }>
  44. It looks like you're using a browser we don't support.
  45. </h2>
  46. <p className = { `${_SNS}__description` }>
  47. Please try again with the latest version of&nbsp;
  48. <a
  49. className = { `${_SNS}__link` }
  50. href = { CHROME } >Chrome</a>,&nbsp;
  51. <a
  52. className = { `${_SNS}__link` }
  53. href = { FIREFOX }>Firefox</a> or&nbsp;
  54. {
  55. this._renderOSSpecificBrowserDownloadLink()
  56. }
  57. </p>
  58. <HideNotificationBarStyle />
  59. </div>
  60. );
  61. }
  62. /**
  63. * Depending on the platform returns the link to Safari browser.
  64. *
  65. * @returns {ReactElement|null}
  66. * @private
  67. */
  68. _renderOSSpecificBrowserDownloadLink() {
  69. let link;
  70. let text;
  71. switch (Platform.OS) {
  72. case 'macos':
  73. link = SAFARI;
  74. text = 'Safari';
  75. break;
  76. case 'windows':
  77. link = IE;
  78. text = 'Internet Explorer';
  79. break;
  80. }
  81. if (typeof link !== 'undefined') {
  82. return (
  83. <a
  84. className = { `${_SNS}__link` }
  85. href = { link }>
  86. {
  87. text
  88. }
  89. </a>
  90. );
  91. }
  92. return null;
  93. }
  94. }
  95. export default translate(UnsupportedDesktopBrowser);