diff --git a/products/ASC.Files/Client/package.json b/products/ASC.Files/Client/package.json index 85d8a1bbea..041b457941 100644 --- a/products/ASC.Files/Client/package.json +++ b/products/ASC.Files/Client/package.json @@ -9,6 +9,7 @@ "asc-web-components": "file:../../../packages/asc-web-components", "connected-react-router": "6.6.1", "copy-to-clipboard": "^3.2.0", + "fast-deep-equal": "^3.1.3", "history": "4.10.1", "i18next": "19.0.3", "i18next-browser-languagedetector": "4.0.1", diff --git a/products/ASC.Files/Client/src/App.js b/products/ASC.Files/Client/src/App.js index 9d1b7506b5..81945f28f7 100644 --- a/products/ASC.Files/Client/src/App.js +++ b/products/ASC.Files/Client/src/App.js @@ -1,6 +1,6 @@ import React, { Suspense } from "react"; import { connect } from "react-redux"; -import { Router, Switch, Redirect } from "react-router-dom"; +import { Router, Switch, Redirect, Route } from "react-router-dom"; import Home from "./components/pages/Home"; import DocEditor from "./components/pages/DocEditor"; import Settings from "./components/pages/Settings"; @@ -98,7 +98,7 @@ class App extends React.Component { path={`${homepage}/settings/:setting`} component={Settings} /> - - this.setState({ showSharingPanel: !this.state.showSharingPanel }); + this.props.setSharingPanelVisible(!this.props.sharingPanelVisible); onClickLinkForPortal = () => { const { settings, selection } = this.props; @@ -795,7 +796,7 @@ class SectionBodyContent extends React.Component { if (currentProps.sectionWidth !== nextProps.sectionWidth) { return true; } - if (!isEqual(currentProps.data, nextProps.data)) { + if (!equal(currentProps.data, nextProps.data)) { return true; } if (currentProps.viewAs !== nextProps.viewAs) { @@ -1574,12 +1575,7 @@ class SectionBodyContent extends React.Component { tooltipValue, } = this.props; - const { - editingId, - showSharingPanel, - showMoveToPanel, - showCopyPanel, - } = this.state; + const { editingId, showMoveToPanel, showCopyPanel } = this.state; const operationsPanelProps = { setIsLoading, @@ -1843,12 +1839,6 @@ class SectionBodyContent extends React.Component { extsImagePreviewed={mediaViewerImageFormats} //TODO /> )} - {showSharingPanel && ( - - )} ); } @@ -1898,6 +1888,7 @@ const mapStateToProps = (state) => { viewer: getCurrentUser(state), tooltipValue: getTooltipLabel(state), iconOfDraggedFile: getIconOfDraggedFile(state)(state), + sharingPanelVisible: getSharePanelVisible(state), }; }; @@ -1923,4 +1914,5 @@ export default connect(mapStateToProps, { getFileInfo, addFileToRecentlyViewed, loopFilesOperations, + setSharingPanelVisible, })(withRouter(withTranslation()(SectionBodyContent))); diff --git a/products/ASC.Files/Client/src/components/pages/Home/Section/Filter/index.js b/products/ASC.Files/Client/src/components/pages/Home/Section/Filter/index.js index c8a1a4db98..fb4c01c056 100644 --- a/products/ASC.Files/Client/src/components/pages/Home/Section/Filter/index.js +++ b/products/ASC.Files/Client/src/components/pages/Home/Section/Filter/index.js @@ -17,7 +17,7 @@ import result from "lodash/result"; import { withTranslation } from "react-i18next"; import { withRouter } from "react-router"; import { constants, FilterInput, store, Loaders, utils } from "asc-web-common"; -import isEqual from "lodash/isEqual"; +import equal from "fast-deep-equal/react"; import { isMobileOnly } from "react-device-detect"; const { withLayoutSize } = utils; @@ -285,7 +285,7 @@ class SectionFilterContent extends React.Component { shouldComponentUpdate(nextProps, nextState) { return ( - !isEqual(this.props.filter, nextProps.filter) || + !equal(this.props.filter, nextProps.filter) || this.props.selectedFolderId !== nextProps.selectedFolderId || this.state.isReady !== nextState.isReady || this.props.viewAs !== nextProps.viewAs || diff --git a/products/ASC.Files/Client/src/components/pages/Home/Section/Header/index.js b/products/ASC.Files/Client/src/components/pages/Home/Section/Header/index.js index c1d565e832..a4e5379581 100644 --- a/products/ASC.Files/Client/src/components/pages/Home/Section/Header/index.js +++ b/products/ASC.Files/Client/src/components/pages/Home/Section/Header/index.js @@ -26,6 +26,7 @@ import { clearSecondaryProgressData, setIsLoading, setSelected, + setSharingPanelVisible, } from "../../../../../store/files/actions"; import { TIMEOUT } from "../../../../../helpers/constants"; import { @@ -33,7 +34,7 @@ import { DeleteDialog, DownloadDialog, } from "../../../../dialogs"; -import { SharingPanel, OperationsPanel } from "../../../../panels"; +import { OperationsPanel } from "../../../../panels"; import { isCanBeDeleted, getIsRecycleBinFolder, @@ -49,6 +50,8 @@ import { getHeaderChecked, getOnlyFoldersSelected, getAccessedSelected, + getSelectionLength, + getSharePanelVisible, } from "../../../../../store/files/selectors"; const { isAdmin } = store.auth.selectors; @@ -146,7 +149,6 @@ class SectionHeaderContent extends React.Component { super(props); this.state = { - showSharingPanel: false, showDeleteDialog: false, showDownloadDialog: false, showEmptyTrashDialog: false, @@ -302,7 +304,7 @@ class SectionHeaderContent extends React.Component { renameAction = () => toastr.info("renameAction click"); onOpenSharingPanel = () => - this.setState({ showSharingPanel: !this.state.showSharingPanel }); + this.props.setSharingPanelVisible(!this.props.sharingPanelVisible); onDeleteAction = () => this.setState({ showDeleteDialog: !this.state.showDeleteDialog }); @@ -505,7 +507,6 @@ class SectionHeaderContent extends React.Component { const { showDeleteDialog, - showSharingPanel, showEmptyTrashDialog, showDownloadDialog, showMoveToPanel, @@ -621,13 +622,6 @@ class SectionHeaderContent extends React.Component { /> )} - {showSharingPanel && ( - - )} - {showMoveToPanel && ( { - const selection = getSelection(state); - return { isRootFolder: getIsRootFolder(state), isAdmin: isAdmin(state), isRecycleBin: getIsRecycleBinFolder(state), parentId: getSelectedFolderParentId(state), - selection, + selection: getSelection(state), title: getSelectedFolderTitle(state), filter: getFilter(state), deleteDialogVisible: isCanBeDeleted(state), @@ -677,7 +669,8 @@ const mapStateToProps = (state) => { isHeaderChecked: getHeaderChecked(state), isAccessedSelected: getAccessedSelected(state), isOnlyFoldersSelected: getOnlyFoldersSelected(state), - isItemsSelected: selection.length, + isItemsSelected: getSelectionLength(state), + sharingPanelVisible: getSharePanelVisible(state), }; }; @@ -688,4 +681,5 @@ export default connect(mapStateToProps, { clearSecondaryProgressData, fetchFiles, setSelected, + setSharingPanelVisible, })(withTranslation()(withRouter(SectionHeaderContent))); diff --git a/products/ASC.Files/Client/src/components/pages/Home/index.js b/products/ASC.Files/Client/src/components/pages/Home/index.js index bca4a414c8..f7d2fbf3d9 100644 --- a/products/ASC.Files/Client/src/components/pages/Home/index.js +++ b/products/ASC.Files/Client/src/components/pages/Home/index.js @@ -37,9 +37,11 @@ import { getIsLoading, getIsRecycleBinFolder, getDragging, + getSharePanelVisible, } from "../../../store/files/selectors"; import { ConvertDialog } from "../../dialogs"; +import { SharingPanel } from "../../panels"; import { createI18N } from "../../../helpers/i18n"; import { getFilterByLocation } from "../../../helpers/converters"; const i18n = createI18N({ @@ -172,6 +174,7 @@ class PureHome extends React.Component { secondaryProgressData, viewAs, convertDialogVisible, + sharingPanelVisible, fileActionId, isRecycleBin, isLoaded, @@ -182,6 +185,8 @@ class PureHome extends React.Component { {convertDialogVisible && ( )} + + {sharingPanelVisible && } - {t("Size")}: -
- - 600 x 800 px - - - 400 x 600 px - - - {t("Auto")} - -
-
-
- {t("Width")}: - +
+ {t("Size")}: +
+ + 600 x 800 px + + + 400 x 600 px + + + {t("Auto")} +
-
- {t("Height")}: - +
+
+ {t("Width")}: + +
+
+ {t("Height")}: + +
+
+
+ + {t("EmbedCode")}: + + +