From 9572d260f628e373fc87f50f3488236109bd6ef1 Mon Sep 17 00:00:00 2001 From: Akmal Isomadinov Date: Thu, 1 Aug 2024 18:05:07 +0500 Subject: [PATCH] Client:EmptyView Added a empty room public screen --- .../client/public/locales/en/EmptyView.json | 3 + .../EmptyContainer/EmptyFolderContainer.js | 5 +- .../EmptyViewContainer.helpers.tsx | 55 +++++++++++++++++-- .../EmptyViewContainer/EmptyViewContainer.tsx | 4 +- 4 files changed, 55 insertions(+), 12 deletions(-) diff --git a/packages/client/public/locales/en/EmptyView.json b/packages/client/public/locales/en/EmptyView.json index f206d5a321..53c5e6b690 100644 --- a/packages/client/public/locales/en/EmptyView.json +++ b/packages/client/public/locales/en/EmptyView.json @@ -12,8 +12,11 @@ "FormRoomEmptyTitle": "Welcome to the Form filling room", "InviteUsersOptionDescription": "Add portal members for joint editing in the room", "InviteUsersOptionTitle": "Inviting Attendees", + "PublicRoomEmptyTitle": "Welcome to the Public room", "ShareOptionDescription": "Copy a public access link or invite other users to the room to start the form filling process.", "ShareOptionTitle": "Share a room", + "SharePublicRoomOptionDescription": "Enable external link access to other users.", + "SharePublicRoomOptionTitle": "Share the room with all users", "UploadDeviceOptionDescription": "Upload any type files from your personal device", "UploadDeviceOptionTitle": "Upload from your Device", "UploadDevicePDFFormOptionDescription": "Upload a ready PDF form to the room from your device.", diff --git a/packages/client/src/components/EmptyContainer/EmptyFolderContainer.js b/packages/client/src/components/EmptyContainer/EmptyFolderContainer.js index 35f0108100..092d58de2e 100644 --- a/packages/client/src/components/EmptyContainer/EmptyFolderContainer.js +++ b/packages/client/src/components/EmptyContainer/EmptyFolderContainer.js @@ -79,10 +79,7 @@ const EmptyFolderContainer = ({ [t, canCreateFiles, type], ); - if ( - roomType === RoomsType.FormRoom || - parentRoomType === FolderType.FormRoom - ) { + if (roomType || parentRoomType === FolderType.FormRoom) { return (
) - .with([RoomsType.PublicRoom, P._], () =>
) + .with( + [ + RoomsType.PublicRoom, + P.union(ShareAccessRights.None, ShareAccessRights.RoomManager), // owner, docspace admin, room admin + ], + () => + isBaseTheme ? ( + + ) : ( + + ), + ) + .with([RoomsType.PublicRoom, ShareAccessRights.Collaborator], () => + isBaseTheme ? ( + + ) : ( + + ), + ) .with( [ RoomsType.CustomRoom, @@ -381,7 +405,7 @@ export const getOptions = ( t("EmptyView:InviteUsersOptionDescription"), ); - const shareRoom = { + const shareFillingRoom = { title: t("EmptyView:ShareOptionTitle"), description: t("EmptyView:ShareOptionDescription"), icon: , @@ -390,6 +414,15 @@ export const getOptions = ( disabled: false, }; + const sharePublicRoom = { + title: t("EmptyView:SharePublicRoomOptionTitle"), + description: t("EmptyView:SharePublicRoomOptionDescription"), + icon: , + key: "share-public-room", + onClick: actions.createAndCopySharedLink, + disabled: false, + }; + const createFile: EmptyViewItemType = { title: t("EmptyView:CreateNewFileTitle"), description: t("EmptyView:CreateNewFileDescription"), @@ -461,13 +494,23 @@ export const getOptions = ( if (isFormFiller) return []; if (isCollaborator) - return [uploadPDFFromDocSpace, uploadFromDevicePDF, shareRoom]; + return [uploadPDFFromDocSpace, uploadFromDevicePDF, shareFillingRoom]; - return [uploadPDFFromDocSpace, uploadFromDevicePDF, shareRoom]; + return [uploadPDFFromDocSpace, uploadFromDevicePDF, shareFillingRoom]; case RoomsType.EditingRoom: return []; case RoomsType.PublicRoom: - return []; + if (isNotAdmin) return []; + + if (isCollaborator) + return [createFile, uploadAllFromDocSpace, uploadFromDeviceAnyFile]; + + return [ + createFile, + sharePublicRoom, + uploadAllFromDocSpace, + uploadFromDeviceAnyFile, + ]; case RoomsType.CustomRoom: if (isNotAdmin) return []; diff --git a/packages/client/src/components/EmptyContainer/sub-components/EmptyViewContainer/EmptyViewContainer.tsx b/packages/client/src/components/EmptyContainer/sub-components/EmptyViewContainer/EmptyViewContainer.tsx index 8d29734caf..307b606715 100644 --- a/packages/client/src/components/EmptyContainer/sub-components/EmptyViewContainer/EmptyViewContainer.tsx +++ b/packages/client/src/components/EmptyContainer/sub-components/EmptyViewContainer/EmptyViewContainer.tsx @@ -184,7 +184,7 @@ const EmptyViewContainer = observer( }, ); -const injectedEmptyViewContainer = inject( +const InjectedEmptyViewContainer = inject( ({ contextOptionsStore, selectedFolderStore, dialogsStore }) => { const { onClickInviteUsers, onCreateAndCopySharedLink } = contextOptionsStore; @@ -206,4 +206,4 @@ const injectedEmptyViewContainer = inject( }, )(EmptyViewContainer); -export default injectedEmptyViewContainer; +export default InjectedEmptyViewContainer;