From 9c01f05de8835ea7408a8ed757c918fa7034ae51 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Mon, 11 Apr 2022 13:22:04 +0300 Subject: [PATCH] Web:Studio:Settings: hide article when catalog item changed --- .../pages/Settings/Layout/Article/Body/index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/web/ASC.Web.Client/src/components/pages/Settings/Layout/Article/Body/index.js b/web/ASC.Web.Client/src/components/pages/Settings/Layout/Article/Body/index.js index c53f287700..35a5748a21 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/Layout/Article/Body/index.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/Layout/Article/Body/index.js @@ -6,6 +6,10 @@ import { withTranslation } from "react-i18next"; import { isArrayEqual } from "@appserver/components/utils/array"; +import { isMobileOnly } from "react-device-detect"; + +import { isMobile } from "@appserver/components/utils/device"; + import { //getKeyByLink, settingsTree, @@ -55,7 +59,7 @@ class ArticleBodyContent extends React.Component { componentDidUpdate(prevProps, prevState) { if (!isArrayEqual(prevState.selectedKeys, this.state.selectedKeys)) { const { selectedKeys } = this.state; - console.log(selectedKeys); + const { match, history } = this.props; const settingsPath = getSelectedLinkByKey(selectedKeys[0], settingsTree); const newPath = match.path + settingsPath; @@ -66,13 +70,17 @@ class ArticleBodyContent extends React.Component { onSelect = (value) => { const { selectedKeys } = this.state; - console.log(selectedKeys, value); + const { toggleArticleOpen } = this.props; if (isArrayEqual([value], selectedKeys)) { return; } this.setState({ selectedKeys: [value + "-0"] }); + + if (isMobileOnly || isMobile()) { + toggleArticleOpen(); + } }; mapKeys = (tKey) => { @@ -145,5 +153,6 @@ class ArticleBodyContent extends React.Component { export default inject(({ auth }) => { return { showText: auth.settingsStore.showText, + toggleArticleOpen: auth.settingsStore.toggleArticleOpen, }; })(withRouter(withTranslation("Settings")(observer(ArticleBodyContent))));