diff --git a/.eslintrc.js b/.eslintrc.js
index c3bbd9fc7eec2295d47aaadeee27d970c72dd3a7..f8d67ff99aeb61aca8b05120062fa532c307775f 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -9,6 +9,9 @@ module.exports = {
jest: true,
jasmine: true,
},
+ globals: {
+ APP_TYPE: true,
+ },
rules: {
'react/jsx-filename-extension': [1, { extensions: ['.js'] }],
'react/jsx-wrap-multilines': 0,
diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js
index 1acfc6a25ac9c41a4ce876bea9707ebcbcb8f1da..3b59e48aef9e2642e6155f7121934bda6ff59367 100644
--- a/src/layouts/BasicLayout.js
+++ b/src/layouts/BasicLayout.js
@@ -201,6 +201,16 @@ class BasicLayout extends React.PureComponent {
});
};
+ renderSettingDrawer() {
+ // Do show SettingDrawer in production
+ // unless deployed in preview.pro.ant.design as demo
+ const { rendering } = this.state;
+ if ((rendering || process.env.NODE_ENV === 'production') && APP_TYPE !== 'site') {
+ return null;
+ }
+ return ;
+ }
+
render() {
const {
navTheme,
@@ -208,7 +218,7 @@ class BasicLayout extends React.PureComponent {
children,
location: { pathname },
} = this.props;
- const { rendering, isMobile } = this.state;
+ const { isMobile } = this.state;
const isTop = PropsLayout === 'topmenu';
const menuData = this.getMenuData();
const layout = (
@@ -242,6 +252,7 @@ class BasicLayout extends React.PureComponent {
);
+
return (
@@ -253,9 +264,7 @@ class BasicLayout extends React.PureComponent {
)}
- {(rendering || process.env.NODE_ENV === 'production') ? null : ( // Do show SettingDrawer in production
-
- )}
+ {this.renderSettingDrawer()}
);
}
diff --git a/src/models/setting.js b/src/models/setting.js
index 0feaa9085ba44470d1464c7a9f21d05054c6f51a..477a958896081c7f029597e9243ba44fcf8810e1 100644
--- a/src/models/setting.js
+++ b/src/models/setting.js
@@ -4,11 +4,9 @@ import defaultSettings from '../defaultSettings';
let lessNodesAppended;
const updateTheme = primaryColor => {
// // Don't compile less in production!
- /* eslint-disable */
if (APP_TYPE !== 'site') {
return;
}
- /* eslint-disable */
// Determine if the component is remounted
if (!primaryColor) {
return;
@@ -111,8 +109,8 @@ export default {
if (state.primaryColor !== primaryColor) {
updateTheme(primaryColor);
}
- if (state.contentWidth !== contentWidth) {
- window.dispatchEvent ? window.dispatchEvent(new Event('resize')) : null;
+ if (state.contentWidth !== contentWidth && window.dispatchEvent) {
+ window.dispatchEvent(new Event('resize'));
}
updateColorWeak(colorWeak);
window.history.replaceState(null, 'setting', urlParams.href);