From fca8a6ddeca5ab2b793e39426e70042678099ca8 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 9 Feb 2022 12:21:36 +0300 Subject: [PATCH] Web: Files: fixed hotkey bugs --- .../ASC.Files/Client/src/HOCs/withHotkeys.js | 2 -- .../Client/src/store/DialogsStore.js | 21 +++++++++++++++++ .../ASC.Files/Client/src/store/HotkeyStore.js | 23 ++++++------------- products/ASC.Files/Client/src/store/index.js | 1 - 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/products/ASC.Files/Client/src/HOCs/withHotkeys.js b/products/ASC.Files/Client/src/HOCs/withHotkeys.js index 667a0c9377..d944d845ff 100644 --- a/products/ASC.Files/Client/src/HOCs/withHotkeys.js +++ b/products/ASC.Files/Client/src/HOCs/withHotkeys.js @@ -30,8 +30,6 @@ const withHotkeys = (Component) => { selectAll, } = props; - console.log("props", props.sectionWidth); - const hotkeysFilter = { filter: (ev) => ev.target?.type === "checkbox" || ev.target?.tagName !== "INPUT", diff --git a/products/ASC.Files/Client/src/store/DialogsStore.js b/products/ASC.Files/Client/src/store/DialogsStore.js index a4064c7d7f..33d2c9d79a 100644 --- a/products/ASC.Files/Client/src/store/DialogsStore.js +++ b/products/ASC.Files/Client/src/store/DialogsStore.js @@ -201,6 +201,27 @@ class DialogsStore { setHotkeyPanelVisible = (hotkeyPanelVisible) => { this.hotkeyPanelVisible = hotkeyPanelVisible; }; + + get someDialogIsOpen() { + return ( + this.sharingPanelVisible || + this.ownerPanelVisible || + this.moveToPanelVisible || + this.copyPanelVisible || + this.deleteThirdPartyDialogVisible || + this.connectDialogVisible || + this.thirdPartyMoveDialogVisible || + this.deleteDialogVisible || + this.downloadDialogVisible || + this.emptyTrashDialogVisible || + this.thirdPartyDialogVisible || + this.newFilesPanelVisible || + this.conflictResolveDialogVisible || + this.convertDialogVisible || + this.selectFileDialogVisible || + this.hotkeyPanelVisible + ); + } } export default DialogsStore; diff --git a/products/ASC.Files/Client/src/store/HotkeyStore.js b/products/ASC.Files/Client/src/store/HotkeyStore.js index 65a3110460..7e98ba5f54 100644 --- a/products/ASC.Files/Client/src/store/HotkeyStore.js +++ b/products/ASC.Files/Client/src/store/HotkeyStore.js @@ -1,21 +1,14 @@ +import { isDesktop } from "@appserver/components/utils/device"; import { makeAutoObservable } from "mobx"; class HotkeyStore { - authStore; filesStore; dialogsStore; settingsStore; filesActionsStore; - constructor( - authStore, - filesStore, - dialogsStore, - settingsStore, - filesActionsStore - ) { + constructor(filesStore, dialogsStore, settingsStore, filesActionsStore) { makeAutoObservable(this); - this.authStore = authStore; this.filesStore = filesStore; this.dialogsStore = dialogsStore; this.settingsStore = settingsStore; @@ -307,6 +300,7 @@ class HotkeyStore { openItem = () => { const { selection } = this.filesStore; selection.length === 1 && + !this.dialogsStore.someDialogIsOpen && this.filesActionsStore.openFileAction(selection[0]); }; @@ -327,17 +321,14 @@ class HotkeyStore { }; get countTilesInRow() { - const { isArticlePinned } = this.authStore.settingsStore; - const sectionPadding = isArticlePinned ? 24 : 16; + const isDesktopView = isDesktop(); + const tileGap = isDesktopView ? 16 : 12; + const minTileWidth = 220 + tileGap; + const sectionPadding = isDesktopView ? 24 : 18; const body = document.getElementById("section"); const sectionWidth = body ? body.offsetWidth - sectionPadding : 0; - const minTileWidth = isArticlePinned ? 220 + 10 : 220 + 18; - - console.log("sectionWidth", sectionWidth); - console.log("countTilesInRow", sectionWidth / minTileWidth); - return Math.floor(sectionWidth / minTileWidth); } diff --git a/products/ASC.Files/Client/src/store/index.js b/products/ASC.Files/Client/src/store/index.js index b911e0bdd5..34205cc916 100644 --- a/products/ASC.Files/Client/src/store/index.js +++ b/products/ASC.Files/Client/src/store/index.js @@ -75,7 +75,6 @@ const filesActionsStore = new FilesActionsStore( const versionHistoryStore = new VersionHistoryStore(filesStore); const hotkeyStore = new HotkeyStore( - store.auth, filesStore, dialogsStore, settingsStore,