From 93d011aee6d8ca630f5afe9ce87abbd05c87f1d8 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 18 Aug 2021 14:26:25 +0300 Subject: [PATCH 01/11] Web: Files: fixed ItemIcon --- .../ASC.Files/Client/src/components/ItemIcon.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/products/ASC.Files/Client/src/components/ItemIcon.js b/products/ASC.Files/Client/src/components/ItemIcon.js index 0d82dc92942..9dd1f4d8505 100644 --- a/products/ASC.Files/Client/src/components/ItemIcon.js +++ b/products/ASC.Files/Client/src/components/ItemIcon.js @@ -1,7 +1,13 @@ import React from "react"; -import { ReactSVG } from "react-svg"; import { EncryptedFileIcon } from "./Icons"; import { inject, observer } from "mobx-react"; +import styled from "styled-components"; + +const StyledIcon = styled.img` + width: 24px; + height: 24px; + margin-top: 4px; +`; const ItemIcon = ({ id, @@ -17,14 +23,11 @@ const ItemIcon = ({ (actionType !== null && actionId === id && fileExst === actionExtension) || id <= 0; - const svgLoader = () =>
; - return ( <> - {isPrivacy && fileExst && ( From d0b7e2d82d55abdc1575f5202f20d8ee8b7e127a Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 18 Aug 2021 14:27:25 +0300 Subject: [PATCH 02/11] Web: Files: fixed Article Body re-render --- .../components/Article/Body/TreeFolders.js | 11 +++- .../src/components/Article/Body/index.js | 56 +++++-------------- .../panels/OperationsPanel/index.js | 1 + 3 files changed, 26 insertions(+), 42 deletions(-) diff --git a/products/ASC.Files/Client/src/components/Article/Body/TreeFolders.js b/products/ASC.Files/Client/src/components/Article/Body/TreeFolders.js index 491ee24d548..a7150a83777 100644 --- a/products/ASC.Files/Client/src/components/Article/Body/TreeFolders.js +++ b/products/ASC.Files/Client/src/components/Article/Body/TreeFolders.js @@ -462,7 +462,7 @@ TreeFolders.defaultProps = { }; export default inject( - ({ auth, filesStore, treeFoldersStore, selectedFolderStore }) => { + ({ auth, filesStore, treeFoldersStore, selectedFolderStore }, props) => { const { filter, selection, @@ -484,6 +484,14 @@ export default inject( } = treeFoldersStore; const { id /* rootFolderType */ } = selectedFolderStore; + const selectedNode = treeFoldersStore.selectedTreeNode; + const selectedKeys = + selectedNode.length > 0 && + selectedNode[0] !== "@my" && + selectedNode[0] !== "@common" + ? selectedNode + : [selectedFolderStore.id + ""]; + return { isAdmin: auth.isAdmin, isDesktop: auth.settingsStore.isDesktopClient, @@ -497,6 +505,7 @@ export default inject( draggableItems: dragging ? selection : [], expandedKeys, treeFolders, + selectedKeys: props.selectedKeys ? props.selectedKeys : selectedKeys, setDragging, setIsLoading, diff --git a/products/ASC.Files/Client/src/components/Article/Body/index.js b/products/ASC.Files/Client/src/components/Article/Body/index.js index bbe69f9f008..fce8599492f 100644 --- a/products/ASC.Files/Client/src/components/Article/Body/index.js +++ b/products/ASC.Files/Client/src/components/Article/Body/index.js @@ -12,50 +12,30 @@ import Banner from "./Banner"; import { inject, observer } from "mobx-react"; import { withRouter } from "react-router-dom"; import config from "../../../../package.json"; -import { clickBackdrop, combineUrl } from "@appserver/common/utils"; +import { combineUrl } from "@appserver/common/utils"; import { AppServerConfig } from "@appserver/common/constants"; import FilesFilter from "@appserver/common/api/files/filter"; import { isDesktop, isTablet } from "react-device-detect"; class ArticleBodyContent extends React.Component { - constructor(props) { - super(props); - - const { selectedFolderTitle } = props; - - selectedFolderTitle - ? setDocumentTitle(selectedFolderTitle) - : setDocumentTitle(); - } - - /*componentDidMount() { - if (this.props.currentId) { - const currentId = [this.props.currentId + ""]; - this.props.setSelectedNode(currentId); - } - }*/ - onSelect = (data, e) => { const { - filter, setIsLoading, - selectedTreeNode, setSelectedNode, fetchFiles, homepage, history, } = this.props; - //if (!selectedTreeNode || selectedTreeNode[0] !== data[0]) { setSelectedNode(data); setIsLoading(true); - const selectedFolderTitle = - (e.node && e.node.props && e.node.props.title) || null; + // const selectedFolderTitle = + // (e.node && e.node.props && e.node.props.title) || null; - selectedFolderTitle - ? setDocumentTitle(selectedFolderTitle) - : setDocumentTitle(); + // selectedFolderTitle + // ? setDocumentTitle(selectedFolderTitle) + // : setDocumentTitle(); if (window.location.pathname.indexOf("/filter") > 0) { fetchFiles(data[0]) @@ -78,12 +58,13 @@ class ArticleBodyContent extends React.Component { const { treeFolders, onTreeDrop, - selectedTreeNode, enableThirdParty, isVisitor, personal, } = this.props; + //console.log("Article Body render"); + const campaigns = (localStorage.getItem("campaigns") || "") .split(",") .filter((campaign) => campaign.length > 0); @@ -93,7 +74,6 @@ class ArticleBodyContent extends React.Component { ) : ( <> { - const { fetchFiles, filter, setIsLoading } = filesStore; + const { fetchFiles, setIsLoading } = filesStore; const { treeFolders, setSelectedNode, setTreeFolders } = treeFoldersStore; - const selectedNode = treeFoldersStore.selectedTreeNode; - - const selectedTreeNode = - selectedNode.length > 0 && - selectedNode[0] !== "@my" && - selectedNode[0] !== "@common" - ? selectedNode - : [selectedFolderStore.id + ""]; - const { setNewFilesPanelVisible } = dialogsStore; const { personal } = auth.settingsStore; + const selectedFolderTitle = selectedFolderStore.title; + + selectedFolderTitle + ? setDocumentTitle(selectedFolderTitle) + : setDocumentTitle(); + return { - selectedFolderTitle: selectedFolderStore.title, treeFolders, - selectedTreeNode, - filter, enableThirdParty: settingsStore.enableThirdParty, isVisitor: auth.userStore.user.isVisitor, diff --git a/products/ASC.Files/Client/src/components/panels/OperationsPanel/index.js b/products/ASC.Files/Client/src/components/panels/OperationsPanel/index.js index 5ae056c691c..d9d3bb227c6 100644 --- a/products/ASC.Files/Client/src/components/panels/OperationsPanel/index.js +++ b/products/ASC.Files/Client/src/components/panels/OperationsPanel/index.js @@ -116,6 +116,7 @@ const OperationsPanelComponent = (props) => { Date: Wed, 18 Aug 2021 14:28:20 +0300 Subject: [PATCH 03/11] Web: Files: fixed Header re-render --- .../src/pages/Home/Section/Header/index.js | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Header/index.js b/products/ASC.Files/Client/src/pages/Home/Section/Header/index.js index 87a1e1d1be7..6942746e5aa 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Header/index.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Header/index.js @@ -313,7 +313,7 @@ class SectionHeaderContent extends React.Component { getMenuItems = () => { const { t, - selectionCount, + isSelectionCount, isAccessedSelected, isWebEditSelected, isViewedSelected, @@ -381,21 +381,17 @@ class SectionHeaderContent extends React.Component { }, { label: t("Share"), - disabled: - isFavoritesFolder || - isRecentFolder || - !isAccessedSelected || - selectionCount > 1, + disabled: isFavoritesFolder || isRecentFolder || !isAccessedSelected, onClick: this.onOpenSharingPanel, }, { label: t("Common:Download"), - disabled: !selectionCount, + disabled: !isSelectionCount, onClick: this.downloadAction, }, { label: t("Translations:DownloadAs"), - disabled: !selectionCount || !isWebEditSelected, + disabled: !isSelectionCount || !isWebEditSelected, onClick: this.downloadAsAction, }, { @@ -404,19 +400,19 @@ class SectionHeaderContent extends React.Component { isFavoritesFolder || isRecentFolder || !isAccessedSelected || - !selectionCount || + !isSelectionCount || isThirdPartySelection, onClick: this.onMoveAction, }, { label: t("Translations:Copy"), - disabled: !selectionCount, + disabled: !isSelectionCount, onClick: this.onCopyAction, }, { label: t("Common:Delete"), disabled: - !selectionCount || !deleteDialogVisible || isThirdPartySelection, + !isSelectionCount || !deleteDialogVisible || isThirdPartySelection, onClick: this.onDeleteAction, }, ]; @@ -449,10 +445,7 @@ class SectionHeaderContent extends React.Component { menu.splice(1, 1); } - if ( - (personal && !isWebEditSelected && !isViewedSelected) || - selectionCount > 1 - ) { + if (personal && !isWebEditSelected && !isViewedSelected) { menu.splice(1, 1); } @@ -640,7 +633,7 @@ export default inject( isShareFolder, filter, canCreate, - selectionCount: selection.length, + isSelectionCount: !!selection.length, isHeaderVisible, isHeaderIndeterminate, isHeaderChecked, From 8add130cfa88e93ab0c4c130958e193888d4e40b Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 18 Aug 2021 14:30:19 +0300 Subject: [PATCH 04/11] Web: Files: fixed Home re-render --- .../ASC.Files/Client/src/pages/Home/index.js | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/products/ASC.Files/Client/src/pages/Home/index.js b/products/ASC.Files/Client/src/pages/Home/index.js index 68a730dec8a..802b5d51b71 100644 --- a/products/ASC.Files/Client/src/pages/Home/index.js +++ b/products/ASC.Files/Client/src/pages/Home/index.js @@ -190,20 +190,12 @@ class PureHome extends React.Component { }; componentDidUpdate(prevProps) { const { - isLoading, isProgressFinished, secondaryProgressDataStoreIcon, selectionLength, selectionTitle, - firstLoad, } = this.props; - if (isLoading !== prevProps.isLoading && !firstLoad) { - if (isLoading) { - showLoader(); - } else { - hideLoader(); - } - } + if (this.props.isHeaderVisible !== prevProps.isHeaderVisible) { this.props.setHeaderVisible(this.props.isHeaderVisible); } @@ -239,7 +231,6 @@ class PureHome extends React.Component { secondaryProgressDataStoreIcon, secondaryProgressDataStoreAlert, - isLoading, dragging, tReady, } = this.props; @@ -272,7 +263,6 @@ class PureHome extends React.Component { isLoaded={!firstLoad} isHeaderVisible={isHeaderVisible} onOpenUploadPanel={this.showUploadPanel} - isLoading={isLoading} firstLoad={firstLoad} dragging={dragging} > @@ -366,12 +356,19 @@ export default inject( ? filesStore.selectionTitle : null; + if (!firstLoad) { + if (isLoading) { + showLoader(); + } else { + hideLoader(); + } + } + return { homepage: config.homepage, firstLoad, dragging, fileActionId: id, - isLoading, viewAs, uploaded, converted, From b7df3903dd1477c421716cd5fa1b47224fcaf864 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 18 Aug 2021 15:52:27 +0300 Subject: [PATCH 05/11] Web: Files: fixed the hiding of the article --- .../components/PageLayout/index.js | 68 ++++++++----------- .../PageLayout/sub-components/article.js | 2 +- .../asc-web-common/store/SettingsStore.js | 15 ++++ .../src/components/Article/Body/index.js | 11 +-- 4 files changed, 52 insertions(+), 44 deletions(-) diff --git a/packages/asc-web-common/components/PageLayout/index.js b/packages/asc-web-common/components/PageLayout/index.js index abf6b09f64d..6ea666404b1 100644 --- a/packages/asc-web-common/components/PageLayout/index.js +++ b/packages/asc-web-common/components/PageLayout/index.js @@ -75,12 +75,8 @@ class PageLayout extends React.Component { constructor(props) { super(props); - const isArticleVisibleAndPinned = !!this.props.isArticlePinned; - this.state = { - isBackdropVisible: false, - isArticleVisible: isArticleVisibleAndPinned, - isArticlePinned: isArticleVisibleAndPinned, + isArticlePinned: props.isArticlePinned, }; this.timeoutHandler = null; @@ -95,13 +91,9 @@ class PageLayout extends React.Component { } if ( - (this.props.hideAside && - !this.state.isArticlePinned && - this.props.hideAside !== prevProps.hideAside) || - (this.props.isLoading !== prevProps.isLoading && - this.props.isLoaded && - this.state.isArticleVisible && - !this.state.isArticlePinned) + this.props.hideAside && + !this.state.isArticlePinned && + this.props.hideAside !== prevProps.hideAside ) { this.backdropClick(); } @@ -136,42 +128,34 @@ class PageLayout extends React.Component { }; backdropClick = () => { - this.setState({ - isBackdropVisible: false, - isArticleVisible: false, - isArticlePinned: false, - }); + this.setState({ isArticlePinned: false }); + this.props.setIsBackdropVisible(false); + this.props.setIsArticleVisible(false); isMobile && this.props.setArticleVisibleOnUnpin(false); }; pinArticle = () => { - this.setState({ - isBackdropVisible: false, - isArticlePinned: true, - isArticleVisible: true, - }); + this.setState({ isArticlePinned: true }); + this.props.setIsBackdropVisible(false); + this.props.setIsArticleVisible(true); this.props.setArticlePinned(true); isMobile && this.props.setArticleVisibleOnUnpin(false); }; unpinArticle = () => { - this.setState({ - isBackdropVisible: true, - isArticlePinned: false, - isArticleVisible: true, - }); + this.setState({ isArticlePinned: false }); + this.props.setIsBackdropVisible(true); + this.props.setIsArticleVisible(true); this.props.setArticlePinned(false); isMobile && this.props.setArticleVisibleOnUnpin(true); }; showArticle = () => { - this.setState({ - isBackdropVisible: true, - isArticleVisible: true, - isArticlePinned: false, - }); + this.setState({ isArticlePinned: false }); + this.props.setIsBackdropVisible(true); + this.props.setIsArticleVisible(true); isMobile && this.props.setArticleVisibleOnUnpin(true); }; @@ -221,8 +205,9 @@ class PageLayout extends React.Component { onOpenUploadPanel, isTabletView, firstLoad, - isLoading, dragging, + isArticleVisible, + isBackdropVisible, } = this.props; let articleHeaderContent = null; let articleMainButtonContent = null; @@ -291,17 +276,16 @@ class PageLayout extends React.Component { {isBackdropAvailable && ( )} {isArticleAvailable && (
{isArticleHeaderAvailable && ( @@ -449,7 +433,7 @@ class PageLayout extends React.Component { {isArticleAvailable && ( )} @@ -519,7 +503,6 @@ PageLayout.propTypes = { isTabletView: PropTypes.bool, isHeaderVisible: PropTypes.bool, firstLoad: PropTypes.bool, - isLoading: PropTypes.bool, }; PageLayout.defaultProps = { @@ -541,15 +524,24 @@ export default inject(({ auth }) => { isHeaderVisible, isTabletView, isArticlePinned, + isArticleVisible, + isBackdropVisible, setArticlePinned, setArticleVisibleOnUnpin, + setIsArticleVisible, + setIsBackdropVisible, } = settingsStore; + return { isLoaded, isTabletView, isHeaderVisible, isArticlePinned, + isArticleVisible, setArticlePinned, setArticleVisibleOnUnpin, + setIsArticleVisible, + isBackdropVisible, + setIsBackdropVisible, }; })(observer(PageLayout)); diff --git a/packages/asc-web-common/components/PageLayout/sub-components/article.js b/packages/asc-web-common/components/PageLayout/sub-components/article.js index 6afb5b7c1c1..018e3ea2b9f 100644 --- a/packages/asc-web-common/components/PageLayout/sub-components/article.js +++ b/packages/asc-web-common/components/PageLayout/sub-components/article.js @@ -47,7 +47,7 @@ const StyledArticle = styled.article` ? props.pinned ? ` min-width: 240px; - max-width: ${props.isLoading ? "calc(100vw - 368px)" : "240px"}; + max-width: 240px; .increaseHeight { diff --git a/packages/asc-web-common/store/SettingsStore.js b/packages/asc-web-common/store/SettingsStore.js index 268407aafd2..ddcf5e1941b 100644 --- a/packages/asc-web-common/store/SettingsStore.js +++ b/packages/asc-web-common/store/SettingsStore.js @@ -60,6 +60,8 @@ class SettingsStore { isTabletView = false; isArticlePinned = localStorage.getItem(ARTICLE_PINNED_KEY) === "true" || false; + isArticleVisible = false; + isBackdropVisible = false; isArticleVisibleOnUnpin = false; @@ -105,6 +107,19 @@ class SettingsStore { return `https://helpcenter.onlyoffice.com/${lang}/administration/configuration.aspx#CustomizingPortal_block`; } + setIsArticleVisible = (visible) => { + this.isArticleVisible = visible; + }; + + setIsBackdropVisible = (visible) => { + this.isBackdropVisible = visible; + }; + + hideArticle = () => { + this.setIsArticleVisible(false); + this.setIsBackdropVisible(false); + }; + setValue = (key, value) => { this[key] = value; }; diff --git a/products/ASC.Files/Client/src/components/Article/Body/index.js b/products/ASC.Files/Client/src/components/Article/Body/index.js index fce8599492f..1d5bdac35b9 100644 --- a/products/ASC.Files/Client/src/components/Article/Body/index.js +++ b/products/ASC.Files/Client/src/components/Article/Body/index.js @@ -25,10 +25,12 @@ class ArticleBodyContent extends React.Component { fetchFiles, homepage, history, + hideArticle, } = this.props; setSelectedNode(data); setIsLoading(true); + hideArticle(false); // const selectedFolderTitle = // (e.node && e.node.props && e.node.props.title) || null; @@ -104,7 +106,7 @@ export default inject( const { setNewFilesPanelVisible } = dialogsStore; - const { personal } = auth.settingsStore; + const { personal, hideArticle } = auth.settingsStore; const selectedFolderTitle = selectedFolderStore.title; @@ -116,16 +118,15 @@ export default inject( treeFolders, enableThirdParty: settingsStore.enableThirdParty, isVisitor: auth.userStore.user.isVisitor, + homepage: config.homepage, + personal, setIsLoading, fetchFiles, setSelectedNode, setTreeFolders, setNewFilesPanelVisible, - - homepage: config.homepage, - - personal, + hideArticle, }; } )(observer(withRouter(ArticleBodyContent))); From f53d7eb7181b9839ad8ab35d447f633065cdda01 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 18 Aug 2021 17:17:45 +0300 Subject: [PATCH 06/11] Web: Common: fixed article unpin --- packages/asc-web-common/store/SettingsStore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/asc-web-common/store/SettingsStore.js b/packages/asc-web-common/store/SettingsStore.js index ddcf5e1941b..71652f9de7e 100644 --- a/packages/asc-web-common/store/SettingsStore.js +++ b/packages/asc-web-common/store/SettingsStore.js @@ -108,7 +108,7 @@ class SettingsStore { } setIsArticleVisible = (visible) => { - this.isArticleVisible = visible; + this.isArticleVisible = this.isArticlePinned ? true : visible; }; setIsBackdropVisible = (visible) => { From 70e3e73e707d5f18a39ecef50d2b594633d66d71 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 18 Aug 2021 18:37:31 +0300 Subject: [PATCH 07/11] Web: Files: renamed isSelectionCount to hasSelection --- .../Client/src/pages/Home/Section/Header/index.js | 15 ++++++++------- products/ASC.Files/Client/src/store/FilesStore.js | 4 ++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Header/index.js b/products/ASC.Files/Client/src/pages/Home/Section/Header/index.js index 6942746e5aa..1107c573e40 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Header/index.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Header/index.js @@ -313,7 +313,7 @@ class SectionHeaderContent extends React.Component { getMenuItems = () => { const { t, - isSelectionCount, + hasSelection, isAccessedSelected, isWebEditSelected, isViewedSelected, @@ -386,12 +386,12 @@ class SectionHeaderContent extends React.Component { }, { label: t("Common:Download"), - disabled: !isSelectionCount, + disabled: !hasSelection, onClick: this.downloadAction, }, { label: t("Translations:DownloadAs"), - disabled: !isSelectionCount || !isWebEditSelected, + disabled: !hasSelection || !isWebEditSelected, onClick: this.downloadAsAction, }, { @@ -400,19 +400,19 @@ class SectionHeaderContent extends React.Component { isFavoritesFolder || isRecentFolder || !isAccessedSelected || - !isSelectionCount || + !hasSelection || isThirdPartySelection, onClick: this.onMoveAction, }, { label: t("Translations:Copy"), - disabled: !isSelectionCount, + disabled: !hasSelection, onClick: this.onCopyAction, }, { label: t("Common:Delete"), disabled: - !isSelectionCount || !deleteDialogVisible || isThirdPartySelection, + !hasSelection || !deleteDialogVisible || isThirdPartySelection, onClick: this.onDeleteAction, }, ]; @@ -600,6 +600,7 @@ export default inject( isWebEditSelected, setIsLoading, isViewedSelected, + hasSelection, } = filesStore; const { isRecycleBinFolder, @@ -633,7 +634,7 @@ export default inject( isShareFolder, filter, canCreate, - isSelectionCount: !!selection.length, + hasSelection, isHeaderVisible, isHeaderIndeterminate, isHeaderChecked, diff --git a/products/ASC.Files/Client/src/store/FilesStore.js b/products/ASC.Files/Client/src/store/FilesStore.js index 1f126e458d2..34f0992fde9 100644 --- a/products/ASC.Files/Client/src/store/FilesStore.js +++ b/products/ASC.Files/Client/src/store/FilesStore.js @@ -1246,6 +1246,10 @@ class FilesStore { return this.selection.find((el) => el.title).title; } + get hasSelection() { + return !!this.selection.length; + } + getOptions = (selection, externalAccess = false) => { const { canWebEdit, From d3776ca57883947a982f813011b4f2a3274e08e4 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 18 Aug 2021 18:38:40 +0300 Subject: [PATCH 08/11] Web: Files: moved TreeFolders selectedKeys to store --- .../components/Article/Body/TreeFolders.js | 22 +++++++++---------- .../src/components/Article/Body/index.js | 1 + .../panels/OperationsPanel/index.js | 1 - .../Client/src/store/TreeFoldersStore.js | 10 +++++++++ 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/products/ASC.Files/Client/src/components/Article/Body/TreeFolders.js b/products/ASC.Files/Client/src/components/Article/Body/TreeFolders.js index a7150a83777..21f6a908e60 100644 --- a/products/ASC.Files/Client/src/components/Article/Body/TreeFolders.js +++ b/products/ASC.Files/Client/src/components/Article/Body/TreeFolders.js @@ -157,7 +157,8 @@ class TreeFolders extends React.Component { return false; } - if (draggableItems.find((x) => x.id === item.id)) return false; + if (!draggableItems || draggableItems.find((x) => x.id === item.id)) + return false; // const isMy = rootFolderType === FolderType.USER; // const isCommon = rootFolderType === FolderType.COMMON; @@ -462,7 +463,10 @@ TreeFolders.defaultProps = { }; export default inject( - ({ auth, filesStore, treeFoldersStore, selectedFolderStore }, props) => { + ( + { auth, filesStore, treeFoldersStore, selectedFolderStore }, + { useDefaultSelectedKeys, selectedKeys } + ) => { const { filter, selection, @@ -484,14 +488,6 @@ export default inject( } = treeFoldersStore; const { id /* rootFolderType */ } = selectedFolderStore; - const selectedNode = treeFoldersStore.selectedTreeNode; - const selectedKeys = - selectedNode.length > 0 && - selectedNode[0] !== "@my" && - selectedNode[0] !== "@common" - ? selectedNode - : [selectedFolderStore.id + ""]; - return { isAdmin: auth.isAdmin, isDesktop: auth.settingsStore.isDesktopClient, @@ -502,10 +498,12 @@ export default inject( commonId: commonFolderId, isPrivacy: isPrivacyFolder, filter, - draggableItems: dragging ? selection : [], + draggableItems: dragging ? selection : null, expandedKeys, treeFolders, - selectedKeys: props.selectedKeys ? props.selectedKeys : selectedKeys, + selectedKeys: useDefaultSelectedKeys + ? treeFoldersStore.selectedKeys + : selectedKeys, setDragging, setIsLoading, diff --git a/products/ASC.Files/Client/src/components/Article/Body/index.js b/products/ASC.Files/Client/src/components/Article/Body/index.js index 1d5bdac35b9..445783ef9de 100644 --- a/products/ASC.Files/Client/src/components/Article/Body/index.js +++ b/products/ASC.Files/Client/src/components/Article/Body/index.js @@ -76,6 +76,7 @@ class ArticleBodyContent extends React.Component { ) : ( <> { 0 && + this.selectedTreeNode[0] !== "@my" && + this.selectedTreeNode[0] !== "@common" + ? this.selectedTreeNode + : [this.selectedFolderStore.id + ""]; + return selectedKeys; + } } export default TreeFoldersStore; From b7a57dddc425fc2296a1e66268b382c4ee743ae2 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 18 Aug 2021 18:44:23 +0300 Subject: [PATCH 09/11] Web: Files: fixed SharedButton.js --- products/ASC.Files/Client/src/components/SharedButton.js | 4 ++-- .../src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js | 7 ++++++- .../src/pages/Home/Section/Body/TilesView/FileTile.js | 7 ++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/products/ASC.Files/Client/src/components/SharedButton.js b/products/ASC.Files/Client/src/components/SharedButton.js index 0a0da211216..2d70180add6 100644 --- a/products/ASC.Files/Client/src/components/SharedButton.js +++ b/products/ASC.Files/Client/src/components/SharedButton.js @@ -3,7 +3,7 @@ import Text from "@appserver/components/text"; import IconButton from "@appserver/components/icon-button"; import { inject, observer } from "mobx-react"; -const getSharedButton = ({ +const SharedButton = ({ t, id, isFolder, @@ -46,4 +46,4 @@ export default inject(({ filesActionsStore, dialogsStore }) => { onSelectItem: filesActionsStore.onSelectItem, setSharingPanelVisible: dialogsStore.setSharingPanelVisible, }; -})(observer(getSharedButton)); +})(observer(SharedButton)); diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js b/products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js index ae983812e11..cf32ae3ac48 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js @@ -74,7 +74,12 @@ const SimpleFilesRow = (props) => { const sharedButton = item.canShare && showShare ? ( - + ) : null; const element = ( diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Body/TilesView/FileTile.js b/products/ASC.Files/Client/src/pages/Home/Section/Body/TilesView/FileTile.js index d2ce626d9e4..0490ec50f90 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Body/TilesView/FileTile.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Body/TilesView/FileTile.js @@ -46,7 +46,12 @@ const FilesTile = (props) => { const { thumbnailUrl } = item; const sharedButton = item.canShare && showShare ? ( - + ) : null; const element = ( From fe91f517cc1b5b9bb1203b17f94b3aaf4d7cb38c Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Thu, 19 Aug 2021 13:29:04 +0300 Subject: [PATCH 10/11] Web: Files: fixed routing from settings --- .../ASC.Files/Client/src/components/Article/Body/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/products/ASC.Files/Client/src/components/Article/Body/index.js b/products/ASC.Files/Client/src/components/Article/Body/index.js index 445783ef9de..93bc28e91ae 100644 --- a/products/ASC.Files/Client/src/components/Article/Body/index.js +++ b/products/ASC.Files/Client/src/components/Article/Body/index.js @@ -44,7 +44,9 @@ class ArticleBodyContent extends React.Component { .catch((err) => toastr.error(err)) .finally(() => setIsLoading(false)); } else { - const urlFilter = FilesFilter.getDefault().toUrlParams(); + const newFilter = FilesFilter.getDefault(); + newFilter.folder = data[0]; + const urlFilter = newFilter.toUrlParams(); history.push( combineUrl(AppServerConfig.proxyURL, homepage, `/filter?${urlFilter}`) ); From 26c5d2ed90d707470a612a669d435badcfcfba14 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Thu, 26 Aug 2021 15:07:29 +0300 Subject: [PATCH 11/11] Web: Common: PageLayout: moved isArticlePinned to settingsStore --- .../components/PageLayout/index.js | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/packages/asc-web-common/components/PageLayout/index.js b/packages/asc-web-common/components/PageLayout/index.js index 6ea666404b1..52736f542bc 100644 --- a/packages/asc-web-common/components/PageLayout/index.js +++ b/packages/asc-web-common/components/PageLayout/index.js @@ -75,10 +75,6 @@ class PageLayout extends React.Component { constructor(props) { super(props); - this.state = { - isArticlePinned: props.isArticlePinned, - }; - this.timeoutHandler = null; this.intervalHandler = null; @@ -92,7 +88,7 @@ class PageLayout extends React.Component { if ( this.props.hideAside && - !this.state.isArticlePinned && + !this.props.isArticlePinned && this.props.hideAside !== prevProps.hideAside ) { this.backdropClick(); @@ -128,15 +124,13 @@ class PageLayout extends React.Component { }; backdropClick = () => { - this.setState({ isArticlePinned: false }); + this.props.setArticlePinned(false); this.props.setIsBackdropVisible(false); this.props.setIsArticleVisible(false); isMobile && this.props.setArticleVisibleOnUnpin(false); }; pinArticle = () => { - this.setState({ isArticlePinned: true }); - this.props.setIsBackdropVisible(false); this.props.setIsArticleVisible(true); this.props.setArticlePinned(true); @@ -144,16 +138,14 @@ class PageLayout extends React.Component { }; unpinArticle = () => { - this.setState({ isArticlePinned: false }); this.props.setIsBackdropVisible(true); this.props.setIsArticleVisible(true); - this.props.setArticlePinned(false); isMobile && this.props.setArticleVisibleOnUnpin(true); }; showArticle = () => { - this.setState({ isArticlePinned: false }); + this.props.setArticlePinned(false); this.props.setIsBackdropVisible(true); this.props.setIsArticleVisible(true); isMobile && this.props.setArticleVisibleOnUnpin(true); @@ -208,6 +200,7 @@ class PageLayout extends React.Component { dragging, isArticleVisible, isBackdropVisible, + isArticlePinned, } = this.props; let articleHeaderContent = null; let articleMainButtonContent = null; @@ -283,7 +276,7 @@ class PageLayout extends React.Component { {isArticleAvailable && (
@@ -302,7 +295,7 @@ class PageLayout extends React.Component { )} {isArticleBodyAvailable && ( - + {articleBodyContent ? articleBodyContent.props.children : null} @@ -310,7 +303,7 @@ class PageLayout extends React.Component { )} {isArticleBodyAvailable && ( @@ -333,12 +326,12 @@ class PageLayout extends React.Component {
{isSectionHeaderAvailable && ( {sectionHeaderContent ? sectionHeaderContent.props.children @@ -370,7 +363,7 @@ class PageLayout extends React.Component { uploadFiles={uploadFiles} withScroll={withBodyScroll} autoFocus={isMobile || isTabletView ? false : true} - pinned={this.state.isArticlePinned} + pinned={isArticlePinned} viewAs={viewAs} > {isSectionFilterAvailable && (