Web:Client:Fixed function availability.

This commit is contained in:
gazizova-vlada 2023-09-22 15:48:09 +03:00
parent a1d2c7565b
commit 9965519c89
2 changed files with 21 additions and 14 deletions

View File

@ -52,6 +52,7 @@ import { getContextMenuItems } from "SRC_DIR/helpers/plugins";
import { connectedCloudsTypeTitleTranslation } from "@docspace/client/src/helpers/filesUtils";
import { getOAuthToken } from "@docspace/common/utils";
import api from "@docspace/common/api";
import { FolderType } from "@docspace/common/constants";
const LOADER_TIMER = 500;
let loadingTime;
@ -1200,8 +1201,8 @@ class ContextOptionsStore {
key: "create-room",
label: "Create room",
icon: DownloadReactSvgUrl,
onClick: () => this.onClickCreateRoom(item, t),
disabled: false,
onClick: this.onClickCreateRoom,
disabled: this.selectedFolderStore.rootFolderType !== FolderType.USER,
},
{
id: "option_download",

View File

@ -1580,6 +1580,10 @@ class FilesActionStore {
const canDelete = selection.every((s) => s.security?.Delete);
return !allFilesIsEditing && canDelete && hasSelection;
case "create-room":
const canCreateRoom = rootFolderType === FolderType.USER;
return canCreateRoom;
}
};
@ -1715,6 +1719,12 @@ class FilesActionStore {
this.processCreatingRoomFromData = processCreatingRoomFromData;
};
onClickCreateRoom = () => {
this.setProcessCreatingRoomFromData(true);
const event = new Event(Events.ROOM_CREATE);
window.dispatchEvent(event);
};
getOption = (option, t) => {
const {
setSharingPanelVisible,
@ -1746,16 +1756,12 @@ class FilesActionStore {
};
case "create-room":
// if (!this.isAvailableOption("download")) return null;
// else
if (!this.isAvailableOption("create-room")) return null;
else
return {
id: "menu-create-room",
label: "Create room",
onClick: () => {
this.setProcessCreatingRoomFromData(true);
const event = new Event(Events.ROOM_CREATE);
window.dispatchEvent(event);
},
onClick: this.onClickCreateRoom,
iconUrl: DownloadReactSvgUrl,
};