From f64450ef7cf35b30c4730491e9f30f31f688b98b Mon Sep 17 00:00:00 2001 From: Grégoire Aubert Date: Fri, 28 Apr 2017 11:24:03 +0200 Subject: SONAR-9047 Only load google fonts on sonarqube.com instances --- .../src/main/js/apps/about/components/AboutApp.js | 4 +- .../AboutAppForSonarQubeDotComLazyLoader.js | 47 ++++++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 server/sonar-web/src/main/js/apps/about/components/AboutAppForSonarQubeDotComLazyLoader.js (limited to 'server/sonar-web/src/main/js/apps/about/components') diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutApp.js b/server/sonar-web/src/main/js/apps/about/components/AboutApp.js index 9485847305b..ee0a05da356 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutApp.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutApp.js @@ -36,7 +36,7 @@ import { getFacet } from '../../../api/issues'; import { getAppState, getCurrentUser, getSettingValue } from '../../../store/rootReducer'; import { translate } from '../../../helpers/l10n'; import { fetchAboutPageSettings } from '../actions'; -import AboutAppForSonarQubeDotCom from './AboutAppForSonarQubeDotCom'; +import AboutAppForSonarQubeDotComLazyLoader from './AboutAppForSonarQubeDotComLazyLoader'; import '../styles.css'; type State = { @@ -119,7 +119,7 @@ class AboutApp extends React.PureComponent { if (sonarqubeDotCom && sonarqubeDotCom.value === 'true') { return ( - { + this.setState({ + AboutAppForSonarQubeDotCom: require('./AboutAppForSonarQubeDotCom').default + }); + }); + } + } + + render() { + const { AboutAppForSonarQubeDotCom } = this.state; + if (AboutAppForSonarQubeDotCom) { + return ; + } + return null; + } +} -- cgit v1.2.3