diff --git a/packages/client/src/pages/Home/SelectionArea/AccountsSelectionArea.js b/packages/client/src/pages/Home/SelectionArea/AccountsSelectionArea.js index 17beea983e..df6d59ac81 100644 --- a/packages/client/src/pages/Home/SelectionArea/AccountsSelectionArea.js +++ b/packages/client/src/pages/Home/SelectionArea/AccountsSelectionArea.js @@ -10,8 +10,6 @@ const SelectionArea = (props) => { setSelections(added, removed, clear); }; - const itemHeight = viewAs === "table" ? 49 : 59; - return isMobile ? ( <> ) : ( @@ -23,7 +21,6 @@ const SelectionArea = (props) => { itemClass="user-item" onMove={onMove} viewAs={viewAs} - itemHeight={itemHeight} /> ); }; diff --git a/packages/client/src/pages/Home/SelectionArea/FilesSelectionArea.js b/packages/client/src/pages/Home/SelectionArea/FilesSelectionArea.js index db63c4966e..0ec7c04fd2 100644 --- a/packages/client/src/pages/Home/SelectionArea/FilesSelectionArea.js +++ b/packages/client/src/pages/Home/SelectionArea/FilesSelectionArea.js @@ -11,6 +11,7 @@ const SelectionArea = (props) => { getCountTilesInRow, isRooms, foldersLength, + filesLength, isInfoPanelVisible, } = props; @@ -39,19 +40,26 @@ const SelectionArea = (props) => { }; const selectableClass = viewAs === "tile" ? "files-item" : "window-item"; - const itemHeight = viewAs === "table" ? 49 : viewAs === "row" ? 59 : null; - const countRowsOfFolders = Math.ceil(foldersLength / countTilesInRow); - const division = foldersLength % countTilesInRow; - const countOfMissingTiles = division ? countTilesInRow - division : 0; + const getCountOfMissingFilesTiles = (itemsLength) => { + const division = itemsLength % countTilesInRow; + return division ? countTilesInRow - division : 0; + }; - // const itemsContainer = document.getElementsByClassName(itemsContainerClass); - // const folderHeaderHeight = itemsContainer[0] - // .getElementsByClassName("folder_header")[0] - // .parentElement.getBoundingClientRect().height; - // const filesHeaderHeight = itemsContainer[0] - // .getElementsByClassName("files_header")[0] - // .parentElement.getBoundingClientRect().height; + const arrayTypes = [ + { + type: "file", + rowCount: Math.ceil(filesLength / countTilesInRow), + rowGap: 14, + countOfMissingTiles: getCountOfMissingFilesTiles(filesLength), + }, + { + type: "folder", + rowCount: Math.ceil(foldersLength / countTilesInRow), + rowGap: 12, + countOfMissingTiles: getCountOfMissingFilesTiles(foldersLength), + }, + ]; return isMobile || dragging ? ( <> @@ -64,24 +72,24 @@ const SelectionArea = (props) => { itemClass="files-item" onMove={onMove} viewAs={viewAs} - itemHeight={itemHeight} countTilesInRow={countTilesInRow} isRooms={isRooms} - countRowsOfFolders={countRowsOfFolders} - countOfMissingTiles={countOfMissingTiles} - folderTileGap={12} - fileTileGap={14} - foldersTileHeight={66} - filesTileHeight={222} folderHeaderHeight={35} - filesHeaderHeight={countRowsOfFolders ? 46 : 0} + defaultHeaderHeight={46} + arrayTypes={arrayTypes} /> ); }; export default inject(({ auth, filesStore, treeFoldersStore }) => { - const { dragging, viewAs, setSelections, getCountTilesInRow, folders } = - filesStore; + const { + dragging, + viewAs, + setSelections, + getCountTilesInRow, + folders, + files, + } = filesStore; const { isRoomsFolder, isArchiveFolder } = treeFoldersStore; const { isVisible: isInfoPanelVisible } = auth.infoPanelStore; @@ -94,6 +102,7 @@ export default inject(({ auth, filesStore, treeFoldersStore }) => { getCountTilesInRow, isRooms, foldersLength: folders.length, + filesLength: files.length, isInfoPanelVisible, }; })(observer(SelectionArea)); diff --git a/packages/client/src/pages/PortalSettings/categories/data-management/backup/restore-backup/sub-components/backup-list/index.js b/packages/client/src/pages/PortalSettings/categories/data-management/backup/restore-backup/sub-components/backup-list/index.js index 00d1e6cf6f..f1f8a1fe52 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-management/backup/restore-backup/sub-components/backup-list/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-management/backup/restore-backup/sub-components/backup-list/index.js @@ -170,18 +170,25 @@ const BackupListModalDialog = (props) => { setState((val) => ({ ...val, isChecked: !val.isChecked })); }; - const { onModalClose, isVisibleDialog, t, isCopyingToLocal, theme, standalone } = props; + const { + onModalClose, + isVisibleDialog, + t, + isCopyingToLocal, + theme, + standalone, + } = props; const { filesList, isLoading, selectedFileIndex, isChecked } = state; - const helpContent = () => ( - <> - - {t("RestoreBackupWarningText")}{" "} - {!standalone && ( - - {t("RestoreBackupResetInfoWarningText")} - - )} + const helpContent = () => ( + <> + + {t("RestoreBackupWarningText")}{" "} + {!standalone && ( + + {t("RestoreBackupResetInfoWarningText")} + + )} ); @@ -212,7 +219,7 @@ const BackupListModalDialog = (props) => { @@ -226,8 +233,8 @@ const BackupListModalDialog = (props) => { filesList.length > 0 ? ( ) : ( @@ -255,7 +262,7 @@ const BackupListModalDialog = (props) => { @@ -276,7 +283,7 @@ const BackupListModalDialog = (props) => { primary size="normal" label={t("Common:Restore")} - onClick={this.onRestorePortal} + onClick={onRestorePortal} isDisabled={isCopyingToLocal || !isChecked} />