Skip to content

Commit bcb581a

Browse files
fix: hide menu for mobile
1 parent 78da657 commit bcb581a

3 files changed

Lines changed: 36 additions & 7 deletions

File tree

‎src/public/dist/local/bundle/main.bundle.js‎

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46936,8 +46936,10 @@ __webpack_require__.r(__webpack_exports__);
4693646936
/* harmony import */ var antd_lib_spin__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(antd_lib_spin__WEBPACK_IMPORTED_MODULE_1__);
4693746937
/* harmony import */ var antd_lib_spin_style_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! antd/lib/spin/style/css */ "../../node_modules/antd/lib/spin/style/css.js");
4693846938
/* harmony import */ var antd_lib_spin_style_css__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(antd_lib_spin_style_css__WEBPACK_IMPORTED_MODULE_2__);
46939-
/* harmony import */ var _App_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./App.scss */ "./js/App.scss");
46940-
/* harmony import */ var _App_scss__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_App_scss__WEBPACK_IMPORTED_MODULE_3__);
46939+
/* harmony import */ var utils_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! utils/index */ "./js/utils/index.js");
46940+
/* harmony import */ var _App_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./App.scss */ "./js/App.scss");
46941+
/* harmony import */ var _App_scss__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_App_scss__WEBPACK_IMPORTED_MODULE_4__);
46942+
4694146943

4694246944

4694346945

@@ -46972,11 +46974,11 @@ var App = function App() {
4697246974
}, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(DataBus, {
4697346975
standalone: props.standalone,
4697446976
predefinedState: props.predefinedState
46975-
})), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0__["Suspense"], {
46977+
})), !utils_index__WEBPACK_IMPORTED_MODULE_3__["isMobile"] ? react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0__["Suspense"], {
4697646978
fallback: react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", {
4697746979
className: 'headerPlaceholder'
4697846980
})
46979-
}, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(ViewsSwitches, null)), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0__["Suspense"], {
46981+
}, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(ViewsSwitches, null)) : null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0__["Suspense"], {
4698046982
fallback: null
4698146983
}, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(TopBar, null))), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", {
4698246984
className: "body"
@@ -48932,6 +48934,24 @@ __webpack_require__.r(__webpack_exports__);
4893248934
}, react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_App__WEBPACK_IMPORTED_MODULE_5__["default"], options))), document.getElementById(mountNodeId));
4893348935
});
4893448936

48937+
/***/ }),
48938+
48939+
/***/ "./js/utils/index.js":
48940+
/*!***************************!*\
48941+
!*** ./js/utils/index.js ***!
48942+
\***************************/
48943+
/*! exports provided: detectMobile, isMobile */
48944+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
48945+
48946+
"use strict";
48947+
__webpack_require__.r(__webpack_exports__);
48948+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "detectMobile", function() { return detectMobile; });
48949+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isMobile", function() { return isMobile; });
48950+
var detectMobile = function detectMobile() {
48951+
return window.navigator && /iPhone|iPad|Android|webOS|BlackBerry|Windows Phone/i.test(window.navigator.userAgent);
48952+
};
48953+
var isMobile = detectMobile();
48954+
4893548955
/***/ })
4893648956

4893748957
/******/ });

‎src/public/js/App.js‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import React, { Suspense } from 'react';
22
import Spin from 'antd/lib/spin';
33
import 'antd/lib/spin/style/css';
44

5+
import { isMobile } from 'utils/index';
6+
57
const DataBus = React.lazy(() => import(/* webpackChunkName: "data-bus" */ 'core/dataBus'));
68
const ViewsSwitches = React.lazy(() =>
79
import(/* webpackChunkName: "view-switches" */ 'components/topBar/controls/ViewSwitches/ViewSwitchesContainer')
@@ -28,9 +30,11 @@ const App = (props = {}) => {
2830
<Suspense fallback={null}>
2931
<DataBus standalone={props.standalone} predefinedState={props.predefinedState} />
3032
</Suspense>
31-
<Suspense fallback={<div className={'headerPlaceholder'} />}>
32-
<ViewsSwitches />
33-
</Suspense>
33+
{!isMobile ? (
34+
<Suspense fallback={<div className={'headerPlaceholder'} />}>
35+
<ViewsSwitches />
36+
</Suspense>
37+
) : null}
3438
<Suspense fallback={null}>
3539
<TopBar />
3640
</Suspense>

‎src/public/js/utils/index.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const detectMobile = () =>
2+
window.navigator &&
3+
/iPhone|iPad|Android|webOS|BlackBerry|Windows Phone/i.test(window.navigator.userAgent);
4+
5+
export const isMobile = detectMobile();

0 commit comments

Comments
 (0)