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.

UnsupportedDesktopBrowser.js 2.5KB

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