Merge branch 'develop' into feature/create-private-room

This commit is contained in:
Timofey Boyko 2023-10-20 17:38:18 +03:00
parent e685aa8580
commit 93e485bb8e
24 changed files with 625 additions and 89 deletions

View File

@ -141,7 +141,7 @@ export default function withContent(WrappedContent) {
const { isRecycleBinFolder, isPrivacyFolder, isArchiveFolder } =
treeFoldersStore;
const { replaceFileStream, setEncryptionAccess } = auth;
const { replaceFileStream } = auth;
const { culture, personal, folderFormValidation, isDesktopClient } =
auth.settingsStore;
@ -168,7 +168,7 @@ export default function withContent(WrappedContent) {
openDocEditor,
renameFolder,
replaceFileStream,
setEncryptionAccess,
setIsLoading,
updateFile,
viewAs,

View File

@ -126,6 +126,10 @@ const ArticleMainButtonContent = (props) => {
isGracePeriod,
setInviteUsersWarningDialogVisible,
currentDeviceType,
isPrivateRoom,
isDesktopClient,
isEncryptionSupport,
} = props;
const navigate = useNavigate();
@ -181,7 +185,7 @@ const ArticleMainButtonContent = (props) => {
);
const onUploadFileClick = React.useCallback(() => {
if (isPrivacy) {
if (isPrivateRoom) {
encryptionUploadDialog((encryptedFile, encrypted) => {
encryptedFile.encrypted = encrypted;
startUpload([encryptedFile], null, t);
@ -190,7 +194,7 @@ const ArticleMainButtonContent = (props) => {
inputFilesElement.current.click();
}
}, [
isPrivacy,
isPrivateRoom,
encrypted,
encryptedFile,
encryptionUploadDialog,
@ -289,7 +293,7 @@ const ArticleMainButtonContent = (props) => {
icon: FormFileReactSvgUrl,
label: t("Translations:SubNewFormFile"),
onClick: onShowSelectFileDialog,
disabled: isPrivacy,
disabled: isPrivateRoom,
key: "form-file",
},
{
@ -298,7 +302,7 @@ const ArticleMainButtonContent = (props) => {
icon: FormGalleryReactSvgUrl,
label: t("Common:OFORMsGallery"),
onClick: onShowGallery,
disabled: isPrivacy,
disabled: isPrivateRoom,
key: "form-gallery",
},
],
@ -384,6 +388,7 @@ const ArticleMainButtonContent = (props) => {
className: "main-button_drop-down",
icon: CatalogFolderReactSvgUrl,
label: t("Files:Folder"),
disabled: isPrivateRoom,
onClick: onCreate,
key: "new-folder",
},
@ -415,7 +420,7 @@ const ArticleMainButtonContent = (props) => {
className: "main-button_drop-down",
icon: ActionsUploadReactSvgUrl,
label: t("UploadFolder"),
disabled: isPrivacy,
disabled: isPrivateRoom,
onClick: onUploadFolderClick,
key: "upload-folder",
},
@ -423,7 +428,7 @@ const ArticleMainButtonContent = (props) => {
const menuModel = [...actions];
if (pluginItems.length > 0) {
if (pluginItems.length > 0 && !isPrivateRoom) {
menuModel.push({
id: "actions_more-plugins",
className: "main-button_drop-down",
@ -447,7 +452,7 @@ const ArticleMainButtonContent = (props) => {
setActions(actions);
}, [
t,
isPrivacy,
isPrivateRoom,
currentFolderId,
isAccountsPage,
isSettingsPage,
@ -470,7 +475,12 @@ const ArticleMainButtonContent = (props) => {
? t("Common:Invite")
: t("Common:Actions");
const isDisabled = isSettingsPage
const canCreateEncrypted =
isDesktopClient && isEncryptionSupport && security?.Create;
const isDisabled = isPrivateRoom
? !canCreateEncrypted
: isSettingsPage
? isSettingsPage
: isAccountsPage
? !isAccountsPage
@ -497,19 +507,20 @@ const ArticleMainButtonContent = (props) => {
<>
{isMobileArticle ? (
<>
{!isProfile && (security?.Create || isAccountsPage) && (
<MobileView
t={t}
titleProp={t("Upload")}
actionOptions={actions}
buttonOptions={uploadActions}
isRooms={isRoomsFolder}
mainButtonMobileVisible={
mainButtonMobileVisible && mainButtonVisible
}
onMainButtonClick={onCreateRoom}
/>
)}
{!isProfile &&
(security?.Create || isAccountsPage || canCreateEncrypted) && (
<MobileView
t={t}
titleProp={t("Upload")}
actionOptions={actions}
buttonOptions={uploadActions}
isRooms={isRoomsFolder}
mainButtonMobileVisible={
mainButtonMobileVisible && mainButtonVisible
}
onMainButtonClick={onCreateRoom}
/>
)}
</>
) : isRoomsFolder ? (
<StyledButton
@ -549,17 +560,19 @@ const ArticleMainButtonContent = (props) => {
ref={inputFilesElement}
style={{ display: "none" }}
/>
<input
id="customFolderInput"
className="custom-file-input"
webkitdirectory=""
mozdirectory=""
type="file"
onChange={onFileChange}
onClick={onInputClick}
ref={inputFolderElement}
style={{ display: "none" }}
/>
{isPrivateRoom && (
<input
id="customFolderInput"
className="custom-file-input"
webkitdirectory=""
mozdirectory=""
type="file"
onChange={onFileChange}
onClick={onInputClick}
ref={inputFolderElement}
style={{ display: "none" }}
/>
)}
</>
);
};
@ -597,12 +610,17 @@ export default inject(
selectFileDialogVisible,
} = dialogsStore;
const { enablePlugins, currentColorScheme, currentDeviceType } =
auth.settingsStore;
const {
enablePlugins,
currentColorScheme,
currentDeviceType,
isDesktopClient,
isEncryptionSupport,
} = auth.settingsStore;
const { isVisible: versionHistoryPanelVisible } = versionHistoryStore;
const security = selectedFolderStore.security;
const isPrivateRoom = selectedFolderStore.private;
const currentFolderId = selectedFolderStore.id;
const { isAdmin, isOwner } = auth.userStore.user;
@ -648,6 +666,9 @@ export default inject(
versionHistoryPanelVisible,
security,
currentDeviceType,
isPrivateRoom,
isDesktopClient,
isEncryptionSupport,
};
}
)(

View File

@ -0,0 +1,180 @@
import React from "react";
import styled from "styled-components";
import { inject, observer } from "mobx-react";
import { withTranslation, Trans } from "react-i18next";
import Link from "@docspace/components/link";
import Text from "@docspace/components/text";
import Box from "@docspace/components/box";
import PlusIcon from "PUBLIC_DIR/images/plus.react.svg";
import SecuritySvgUrl from "PUBLIC_DIR/images/security.svg?url";
import EmptyScreenPrivacySvgUrl from "PUBLIC_DIR/images/empty_screen_privacy.svg?url";
import EmptyScreenPrivacyDarkSvgUrl from "PUBLIC_DIR/images/empty_screen_privacy_dark.svg?url";
import EmptyContainer from "./EmptyContainer";
const StyledPlusIcon = styled(PlusIcon)`
path {
fill: #657077;
}
`;
const PrivateFolderContainer = (props) => {
const {
t,
theme,
onCreate,
linkStyles,
isDesktop,
isEncryptionSupport,
organizationName,
privacyInstructions,
isEmptyPage,
setIsEmptyPage,
sectionWidth,
} = props;
const privateRoomHeader = t("PrivateRoomHeader");
const privacyIcon = (
<Box
displayProp={"flex"}
alignItems={"center"}
heightProp={"16px"}
marginProp={"0 8px 0 0"}
>
<img alt="" src={SecuritySvgUrl} />
</Box>
);
const privateRoomDescription = (
<>
<div
className="empty-folder_container-links list-container"
style={{ gap: "8px" }}
>
{privacyIcon}
<Box displayProp={"flex"} alignItems={"center"}>
<Text fontSize={"12px"}>{t("PrivateRoomDescriptionSafest")}</Text>
</Box>
{privacyIcon}
<Box displayProp={"flex"} alignItems={"center"}>
<Text fontSize={"12px"}>{t("PrivateRoomDescriptionSecure")}</Text>
</Box>
{privacyIcon}
<Box displayProp={"flex"} alignItems={"center"}>
<Text fontSize={"12px"}>{t("PrivateRoomDescriptionEncrypted")}</Text>
</Box>
{privacyIcon}
<Box displayProp={"flex"} alignItems={"center"}>
<Text fontSize={"12px"}>
{t("PrivateRoomDescriptionUnbreakable")}
</Text>
</Box>
</div>
<Text fontSize="13px" lineHeight={"20px"}>
<Trans t={t} i18nKey="PrivateRoomSupport" ns="Files">
Work in Private Room is available via {{ organizationName }} desktop
app.
<Link
isBold
isHovered
color={theme.filesEmptyContainer.privateRoom.linkColor}
href={privacyInstructions}
>
Instructions
</Link>
</Trans>
</Text>
</>
);
const commonButtons = (
<span>
<div className="empty-folder_container-links">
<StyledPlusIcon
className="empty-folder_container-image"
data-format="docx"
onClick={onCreate}
alt="plus_icon"
/>
<Box className="flex-wrapper_container">
<Link data-format="docx" onClick={onCreate} {...linkStyles}>
{t("Document")},
</Link>
<Link data-format="xlsx" onClick={onCreate} {...linkStyles}>
{t("Spreadsheet")},
</Link>
<Link data-format="pptx" onClick={onCreate} {...linkStyles}>
{t("Presentation")},
</Link>
<Link data-format="docxf" onClick={onCreate} {...linkStyles}>
{t("Translations:NewForm")}
</Link>
</Box>
</div>
{/* <div className="empty-folder_container-links">
<StyledPlusIcon
className="empty-folder_container-image"
onClick={onCreate}
alt="plus_icon"
/>
<Link {...linkStyles} onClick={onCreate}>
{t("Folder")}
</Link>
</div> */}
</span>
);
return (
<EmptyContainer
headerText={privateRoomHeader}
descriptionText={privateRoomDescription}
imageSrc={
theme.isBase ? EmptyScreenPrivacySvgUrl : EmptyScreenPrivacyDarkSvgUrl
}
buttons={isDesktop && isEncryptionSupport && commonButtons}
isEmptyPage={isEmptyPage}
sectionWidth={sectionWidth}
/>
);
};
export default inject(({ auth, filesStore }) => {
const { isDesktopClient, isEncryptionSupport, organizationName, theme } =
auth.settingsStore;
const {
privacyInstructions,
viewAs,
isEmptyPage,
setIsEmptyPage,
} = filesStore;
return {
theme,
isDesktop: isDesktopClient,
isVisitor: auth.userStore.user.isVisitor,
isEncryptionSupport,
organizationName,
privacyInstructions,
viewAs,
isEmptyPage,
setIsEmptyPage,
};
})(withTranslation(["Files"])(observer(PrivateFolderContainer)));

View File

@ -7,6 +7,7 @@ import EmptyFilterContainer from "./EmptyFilterContainer";
import EmptyFolderContainer from "./EmptyFolderContainer";
import { Events } from "@docspace/common/constants";
import RoomNoAccessContainer from "./RoomNoAccessContainer";
import PrivateFolderContainer from "./PrivateFolderContainer";
const linkStyles = {
isHovered: true,
@ -26,6 +27,7 @@ const EmptyContainer = ({
isRoomNotFoundOrMoved,
isGracePeriod,
setInviteUsersWarningDialogVisible,
isPrivateRoom,
}) => {
const location = useLocation();
@ -69,6 +71,12 @@ const EmptyContainer = ({
return isFiltered ? (
<EmptyFilterContainer linkStyles={linkStyles} />
) : isPrivateRoom ? (
<PrivateFolderContainer
onCreate={onCreate}
linkStyles={linkStyles}
sectionWidth={sectionWidth}
/>
) : isRootEmptyPage ? (
<RootFolderContainer
onCreate={onCreate}
@ -112,6 +120,7 @@ export default inject(
isLoading,
parentId: selectedFolderStore.parentId,
isPrivateRoom: selectedFolderStore.private,
isRoomNotFoundOrMoved,
isGracePeriod,
setInviteUsersWarningDialogVisible,

View File

@ -33,7 +33,8 @@ const CreateEvent = ({
parentId,
isPrivacy,
isPrivateFolder,
updatePrivateFile,
isDesktop,
completeAction,
@ -50,6 +51,7 @@ const CreateEvent = ({
eventDialogVisible,
keepNewFileName,
setPortalTariff,
isPrivateRoom,
}) => {
const [headerTitle, setHeaderTitle] = React.useState(null);
const [startValue, setStartValue] = React.useState("");
@ -243,13 +245,13 @@ const CreateEvent = ({
setCreatedItem({ id: createdFileId, type: "file" });
addActiveItems([file.id]);
if (isPrivacy) {
if (isPrivateRoom) {
return setEncryptionAccess(file).then((encryptedFile) => {
if (!encryptedFile) return Promise.resolve();
toastr.info(t("Translations:EncryptedFileSaving"));
return replaceFileStream(
file.id,
item.id,
encryptedFile,
true,
false
@ -257,9 +259,9 @@ const CreateEvent = ({
() => open && openDocEditor(file.id, file.providerKey, tab)
);
});
} else {
return open && openDocEditor(file.id, file.providerKey, tab);
}
return open && openDocEditor(file.id, file.providerKey, tab);
})
.then(() => completeAction(item, type))
.catch((e) => {
@ -269,7 +271,7 @@ const CreateEvent = ({
.finally(() => {
const fileIds = [+id];
createdFileId && fileIds.push(createdFileId);
isPrivateFolder && updatePrivateFile(item.id);
clearActiveOperations(fileIds);
onCloseAction();
return setIsLoading(false);
@ -320,6 +322,7 @@ export default inject(
openDocEditor,
setIsUpdatingRowItem,
setCreatedItem,
updatePrivateFile,
} = filesStore;
const { gallerySelected, setGallerySelected } = oformsStore;
@ -328,9 +331,9 @@ export default inject(
const { clearActiveOperations, fileCopyAs } = uploadDataStore;
const { isRecycleBinFolder, isPrivacyFolder } = treeFoldersStore;
const { isRecycleBinFolder } = treeFoldersStore;
const { id: parentId } = selectedFolderStore;
const { id: parentId, private: isPrivateRoom } = selectedFolderStore;
const { replaceFileStream, setEncryptionAccess, currentTariffStatusStore } =
auth;
@ -365,7 +368,7 @@ export default inject(
parentId,
isDesktop: isDesktopClient,
isPrivacy: isPrivacyFolder,
isTrashFolder: isRecycleBinFolder,
completeAction,
@ -379,6 +382,8 @@ export default inject(
setEncryptionAccess,
keepNewFileName,
isPrivateRoom,
updatePrivateFile,
};
}
)(observer(CreateEvent));

View File

@ -28,6 +28,7 @@ const CreateRoomEvent = ({
const [fetchedTags, setFetchedTags] = useState([]);
const onCreate = (roomParams) => {
console.log(roomParams);
setRoomParams(roomParams);
setOnClose(onClose);

View File

@ -1,4 +1,4 @@
import SecuritySvgUrl from "PUBLIC_DIR/images/security.svg?url";
import SecuritySvgUrl from "PUBLIC_DIR/images/security.background.react.svg?url";
import React from "react";
import { inject, observer } from "mobx-react";
import styled, { css } from "styled-components";
@ -44,26 +44,26 @@ const EncryptedFileIcon = styled.div`
height: 16px;
position: absolute;
width: 16px;
margin-top: 14px;
margin-top: ${(props) => (props.showDefaultRoomIcon ? "20px" : "14px")};
${(props) =>
props.theme.interfaceDirection === "rtl"
? css`
margin-right: 12px;
margin-right: ${props.showDefaultRoomIcon ? "20px" : "12px"};
`
: css`
margin-left: 12px;
`}
margin-left: ${props.showDefaultRoomIcon ? "20px" : "12px"};
`};
`;
const ItemIcon = ({
icon,
fileExst,
isPrivacy,
isRoom,
title,
logo,
color,
isArchive,
isPrivate,
}) => {
const isLoadedRoomIcon = !!logo?.medium;
const showDefaultRoomIcon = !isLoadedRoomIcon && isRoom;
@ -81,7 +81,12 @@ const ItemIcon = ({
/>
)}
</IconWrapper>
{isPrivacy && fileExst && <EncryptedFileIcon isEdit={false} />}
{isPrivate && (
<EncryptedFileIcon
showDefaultRoomIcon={showDefaultRoomIcon}
isEdit={false}
/>
)}
</>
);
};

View File

@ -100,6 +100,8 @@ const CreateRoomDialog = ({
};
const onCreateRoom = async () => {
console.log(roomParams);
if (!roomParams.title.trim()) {
setIsValidTitle(false);
return;

View File

@ -10,7 +10,7 @@ import RoomType from "./RoomType";
import PermanentSettings from "./PermanentSettings";
import InputParam from "./Params/InputParam";
import ThirdPartyStorage from "./ThirdPartyStorage";
// import IsPrivateParam from "./IsPrivateParam";
import IsPrivateParam from "./IsPrivateParam";
import withLoader from "@docspace/client/src/HOCs/withLoader";
import Loaders from "@docspace/common/components/Loaders";
@ -119,14 +119,13 @@ const SetRoomParams = ({
isDisabled={isDisabled}
/>
{/* //TODO: Uncomment when private rooms are done
{!isEdit && (
<IsPrivateParam
t={t}
isPrivate={roomParams.isPrivate}
onChangeIsPrivate={onChangeIsPrivate}
/>
)} */}
)}
{(isAdmin || isMe) && roomParams.roomOwner && (
<ChangeRoomOwner

View File

@ -315,6 +315,7 @@ const SimpleFilesRow = (props) => {
logo={item.logo}
color={item.logo?.color}
isArchive={item.isArchive}
isPrivate={item.isPrivate}
/>
);

View File

@ -53,6 +53,7 @@ const FilesTableRow = (props) => {
logo={item.logo}
color={item.logo?.color}
isArchive={item.isArchive}
isPrivate={item.isPrivate}
/>
);

View File

@ -79,6 +79,7 @@ const FileTile = (props) => {
logo={item.logo}
color={item.logo?.color}
isArchive={item.isArchive}
isPrivate={item.isPrivate}
/>
);

View File

@ -27,6 +27,7 @@ import PersonManagerReactSvgUrl from "PUBLIC_DIR/images/person.manager.react.svg
import PersonUserReactSvgUrl from "PUBLIC_DIR/images/person.user.react.svg?url";
import InviteAgainReactSvgUrl from "PUBLIC_DIR/images/invite.again.react.svg?url";
import PublicRoomIconUrl from "PUBLIC_DIR/images/public-room.react.svg?url";
import SecuritySvgUrl from "PUBLIC_DIR/images/security.svg?url";
import React from "react";
import { inject, observer } from "mobx-react";
@ -220,6 +221,7 @@ const SectionHeaderContent = (props) => {
moveToPublicRoom,
currentDeviceType,
isFrame,
isPrivateRoom,
} = props;
const navigate = useNavigate();
@ -385,7 +387,7 @@ const SectionHeaderContent = (props) => {
label: t("Translations:SubNewFormFile"),
icon: FormFileReactSvgUrl,
onClick: createFormFromFile,
disabled: isPrivacyFolder,
disabled: isPrivateRoom,
},
{
id: "personal_template_oforms-gallery",
@ -393,7 +395,7 @@ const SectionHeaderContent = (props) => {
label: t("Common:OFORMsGallery"),
icon: FormGalleryReactSvgUrl,
onClick: onShowGallery,
disabled: isPrivacyFolder || (isMobile && isTablet),
disabled: isPrivateRoom || (isMobile && isTablet),
},
],
},
@ -402,6 +404,7 @@ const SectionHeaderContent = (props) => {
key: "new-folder",
label: t("Common:NewFolder"),
onClick: createFolder,
disabled: isPrivateRoom,
icon: CatalogFolderReactSvgUrl,
},
{ key: "separator", isSeparator: true },
@ -415,11 +418,12 @@ const SectionHeaderContent = (props) => {
key: "upload-folder",
label: t("Article:UploadFolder"),
onClick: () => onUploadAction("folder"),
disabled: isPrivateRoom,
icon: ActionsUploadReactSvgUrl,
},
];
if (mainButtonItemsList && enablePlugins) {
if (mainButtonItemsList && enablePlugins && !isPrivateRoom) {
mainButtonItemsList.forEach((option) => {
options.splice(option.value.position, 0, {
key: option.key,
@ -1038,7 +1042,9 @@ const SectionHeaderContent = (props) => {
burgerLogo={isPublicRoom && burgerLogo}
isPublicRoom={isPublicRoom}
titleIcon={
isPublicRoomType && !isPublicRoom && PublicRoomIconUrl
isPrivateRoom
? SecuritySvgUrl
: isPublicRoomType && !isPublicRoom && PublicRoomIconUrl
}
showRootFolderTitle={insideTheRoom}
currentDeviceType={currentDeviceType}
@ -1147,8 +1153,15 @@ export default inject(
const { setIsVisible, isVisible } = auth.infoPanelStore;
const { title, id, roomType, pathParts, navigationPath, security } =
selectedFolderStore;
const {
title,
id,
roomType,
pathParts,
navigationPath,
security,
private: isPrivateRoom,
} = selectedFolderStore;
const selectedFolder = { ...selectedFolderStore };
@ -1211,6 +1224,7 @@ export default inject(
: pathParts?.length === 1;
return {
isPrivateRoom,
isGracePeriod,
setInviteUsersWarningDialogVisible,
showText: auth.settingsStore.showText,

View File

@ -92,6 +92,7 @@ class CreateEditRoomStore {
const createRoomData = {
roomType: roomParams.type,
title: roomParams.title || t("Files:NewRoom"),
private: roomParams.isPrivate,
};
const createTagsData = roomParams.tags

View File

@ -2114,8 +2114,7 @@ class FilesActionStore {
const canWebEdit = item.viewAccessability?.WebEdit;
const canViewedDocs = item.viewAccessability?.WebView;
const { id, viewUrl, providerKey, fileStatus, encrypted, isFolder } = item;
if (encrypted && isPrivacyFolder) return checkProtocol(item.id, true);
const { id, viewUrl, providerKey, fileStatus, isFolder } = item;
if (isRecycleBinFolder || isLoading) return;

View File

@ -2908,6 +2908,7 @@ class FilesStore {
const { fileItemsList } = this.pluginStore;
const { enablePlugins } = this.authStore.settingsStore;
const { private: isPrivateRoom } = this.selectedFolderStore;
const newFolders = [...this.folders];
@ -2972,6 +2973,7 @@ class FilesStore {
viewAccessability,
mute,
inRoom = true,
private: isPrivate,
} = item;
const thirdPartyIcon = this.thirdPartyStore.getThirdPartyIcon(
@ -3118,6 +3120,7 @@ class FilesStore {
viewAccessability,
fileTypeName,
inRoom,
isPrivate: isPrivateRoom || isPrivate || encrypted,
};
});
@ -3863,6 +3866,12 @@ class FilesStore {
);
}
updatePrivateFile = (fileId) => {
const idx = this.files.findIndex((f) => f.id === fileId);
this.files[idx].encrypted = true;
};
get roomsForRestore() {
return this.folders.filter((f) => f.security.Move);
}

View File

@ -31,6 +31,7 @@ class SelectedFolderStore {
rootFolderId = null;
settingsStore = null;
security = null;
private = null;
socketSubscribersId = new Set();
@ -71,6 +72,7 @@ class SelectedFolderStore {
this.tags = null;
this.rootFolderId = null;
this.security = null;
this.private = null;
this.socketSubscribersId = new Set();
};

View File

@ -5,6 +5,10 @@ import * as fakePeople from "./fake";
import { Encoder } from "../../utils/encoder";
import { checkFilterInstance } from "../../utils";
export function getUserTheme() {
return request({ method: "get", url: "/people/theme.json" });
}
export function getUserList(filter = Filter.getDefault(), fake = false) {
let params = "";
if (fake) {

View File

@ -15,6 +15,7 @@ import { inject, observer, Provider as MobxProvider } from "mobx-react";
import ThemeProvider from "@docspace/components/theme-provider";
const isDesktopEditor = window["AscDesktopEditor"] !== undefined;
import PrivacyDeepLink from "./components/PrivacyDeepLink";
import PresentationIcoUrl from "PUBLIC_DIR/images/presentation.ico";
import SpreadSheetIcoUrl from "PUBLIC_DIR/images/spreadsheet.ico";
@ -88,26 +89,36 @@ const App = ({
}, []);
const onError = () => {
window.open(
combineUrl(
window.DocSpaceConfig?.proxy?.url,
rest.personal ? "sign-in" : "/login"
),
"_self"
);
// window.open(
// combineUrl(
// window.DocSpaceConfig?.proxy?.url,
// rest.personal ? "sign-in" : "/login"
// ),
// "_self"
// );
};
const showDeepLink = !isDesktopEditor && rest?.config?.file?.encrypted;
return (
<ErrorBoundary onError={onError}>
<GlobalStyle />
<Editor
mfReady={isInitialized}
mfFailed={isErrorLoading}
isDesktopEditor={isDesktopEditor}
initDesktop={initDesktop}
currentColorScheme={currentColorScheme}
{...rest}
/>
{showDeepLink ? (
<PrivacyDeepLink
fileId={rest?.config?.file?.id}
currentColorScheme={rest?.currentColorScheme}
whiteLabelLogoUrls={rest?.logoUrls}
/>
) : (
<Editor
mfReady={isInitialized}
mfFailed={isErrorLoading}
isDesktopEditor={isDesktopEditor}
initDesktop={initDesktop}
currentColorScheme={currentColorScheme}
{...rest}
/>
)}
</ErrorBoundary>
);
};

View File

@ -0,0 +1,102 @@
import styled, { css } from "styled-components";
import { mobile, tablet } from "@docspace/components/utils/device";
import { Base } from "@docspace/components/themes";
const StyledDeepLinkWrapper = styled.div`
width: 100%;
height: 100vh;
padding-top: 100px;
box-sizing: border-box;
display: flex;
align-items: center;
flex-direction: column;
// background-image: ${(props) => props.bgPattern};
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 100% 100%;
.deep-link__logo {
max-height: 44px;
cursor: pointer;
margin-bottom: 64px;
svg {
path:last-child {
// fill: ${(props) => props.theme.client.home.logoColor};
}
}
}
.deep-link__header {
font-size: 23px;
font-weight: 700;
line-height: 28px;
margin: 0;
margin-bottom: 16px;
}
.deep-link__description {
width: 386px;
max-width: calc(100% - 32px);
font-weight: 400;
font-size: 16px;
line-height: 22px;
text-align: center;
margin-bottom: 32px;
}
@media ${tablet} {
background-size: cover;
}
@media ${mobile} {
background-image: none;
}
`;
StyledDeepLinkWrapper.defaultProps = { theme: Base };
const StyledContentContainer = styled.div`
width: 386px;
max-width: calc(100% - 32px);
padding: 32px;
// box-shadow: ${(props) => props.theme.deepLinkPage.boxShadow};
border-radius: 12px;
box-sizing: border-box;
display: flex;
align-items: center;
flex-direction: column;
// background: ${(props) => props.theme.backgroundColor};
.deep-link-content__description {
font-weight: 400;
font-size: 13px;
line-height: 20px;
}
.deep-link-content__button {
margin-top: 32px;
margin-bottom: 24px;
}
.deep-link-content__without-app {
font-weight: 600;
font-size: 13px;
line-height: 20px;
margin-bottom: 8px;
}
.deep-link-content__download-now {
font-weight: 600;
font-size: 13px;
line-height: 15px;
}
.deep-link-content__mobile-header {
font-weight: 600;
font-size: 16px;
line-height: 22px;
margin-bottom: 8px;
}
.deep-link-content__mobile-description {
font-weight: 400;
font-size: 13px;
line-height: 20px;
text-align: left;
}
`;
StyledContentContainer.defaultProps = { theme: Base };
export { StyledDeepLinkWrapper, StyledContentContainer };

View File

@ -0,0 +1,157 @@
import React from "react";
import { inject, observer } from "mobx-react";
import { useTranslation, Trans } from "react-i18next";
import { ReactSVG } from "react-svg";
import { isMobileOnly, isMobile } from "react-device-detect";
import { getBgPattern } from "@docspace/common/utils";
import Heading from "@docspace/components/heading";
import Text from "@docspace/components/text";
import Button from "@docspace/components/button";
import { checkProtocol } from "../../helpers/utils";
import {
StyledDeepLinkWrapper,
StyledContentContainer,
} from "./StyledPrivacyDeepLink";
const downloadDesktopAppLink = "https://www.onlyoffice.com/desktop.aspx";
const PrivacyDeepLink = ({
fileId,
currentColorScheme,
privacyInstructions,
whiteLabelLogoUrls,
}) => {
const { t } = useTranslation(["DeepLink"]);
const bgPattern = getBgPattern(currentColorScheme?.id);
const logo =
isMobileOnly && whiteLabelLogoUrls?.length > 1
? whiteLabelLogoUrls[0]?.path?.light
: whiteLabelLogoUrls[1]?.path?.light;
const buttonLabel = !isMobile ? t("OpenApp") : t("Instructions");
const isSvgLogo = logo.includes(".svg");
const onOpenHomePage = () => {
window.open("/rooms/shared/filter", "_self");
};
const onOpenInstruction = () => {
window.open(privacyInstructions, "_blank");
};
const onButtonAction = () => {
if (isMobile) {
return onOpenInstruction();
}
checkProtocol(fileId);
};
React.useEffect(() => {
if (!isMobile) {
checkProtocol(fileId);
}
}, [fileId]);
const mobileBlock = (
<>
<Text className="deep-link-content__mobile-header">
{t("NotAvailable")}
</Text>
<Text className="deep-link-content__mobile-description">
{t("UseApp")}
</Text>
</>
);
return (
<StyledDeepLinkWrapper bgPattern={bgPattern}>
<div className="deep-link__logo-container">
{isSvgLogo ? (
<ReactSVG
className="deep-link__logo"
src={logo}
onClick={onOpenHomePage}
/>
) : (
<img
className="deep-link__logo"
src={logo}
onClick={onOpenHomePage}
/>
)}
</div>
{!isMobile && (
<>
<Heading className={"deep-link__header"}> {t("OpeningDoc")}</Heading>
<Text className={"deep-link__description"}>
{t("OpeningDocDesc")}
</Text>
</>
)}
<StyledContentContainer>
{isMobile ? (
mobileBlock
) : (
<Text className={"deep-link-content__description"}>
<Trans t={t} i18nKey="ClickDescription" ns="DeepLink">
Click{" "}
<Text as={"span"} fontWeight={600}>
{{ firstButton: t("OpenAppOnlyoffice") }}
</Text>{" "}
in the browser dialog box. If the dialog box does not appear,
click{" "}
<Text as={"span"} fontWeight={600}>
{{ secondButton: t("OpenApp") }}
</Text>{" "}
below.
</Trans>
</Text>
)}
<Button
className={"deep-link-content__button"}
primary
scale
label={buttonLabel}
size={"medium"}
onClick={onButtonAction}
currentColorScheme={currentColorScheme}
/>
{!isMobile && (
<>
<Text className={"deep-link-content__without-app"}>
{t("MissApp")}
</Text>
{/* <ColorTheme
className={"deep-link-content__download-now"}
href={downloadDesktopAppLink}
target={"_blank"}
type={"action"}
isHovered
themeId={ThemeType.Link}
currentColorScheme={currentColorScheme}
>
{t("DownloadNow")}
</ColorTheme> */}
</>
)}
</StyledContentContainer>
</StyledDeepLinkWrapper>
);
};
export default inject(({ filesStore }) => {
const { privacyInstructions } = filesStore;
return { privacyInstructions };
})(observer(PrivacyDeepLink));

View File

@ -1,6 +1,22 @@
import pkg from "../../../package.json";
import { translations } from "SRC_DIR/autoGeneratedTranslations";
import { combineUrl } from "@docspace/common/utils";
import { EDITOR_PROTOCOL } from "@docspace/client/src/helpers/filesConstants";
export const checkProtocol = (fileId) =>
new Promise((resolve, reject) => {
window.open(
combineUrl(
`${EDITOR_PROTOCOL}:${window.location.origin}`,
"/",
`doceditor?fileId=${fileId}`
),
"_self"
);
});
export function getLanguage(lng) {
try {
let language = lng == "en-US" || lng == "en-GB" ? "en" : lng;

View File

@ -0,0 +1,3 @@
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12.7068 2.61025L12.7068 2.61035C12.7226 2.72404 12.893 3.99303 12.8503 5.54093C12.8084 7.06348 12.5591 8.97176 11.6519 10.282C9.91208 12.7952 7.35275 13.4402 7.20965 13.4748L7.20891 13.4749C7.14062 13.4913 7.0706 13.4997 7.00012 13.4997C6.9302 13.4997 6.85988 13.4915 6.79053 13.4747C6.64754 13.4402 4.08821 12.7952 2.34829 10.282L2.75938 9.99743L2.34829 10.282C1.44115 8.97174 1.19185 7.06344 1.1499 5.54089C1.10726 3.99299 1.27762 2.72401 1.29343 2.61033L1.29344 2.61028C1.34242 2.25835 1.59557 1.96889 1.93804 1.87367L12.7068 2.61025ZM12.7068 2.61025C12.6578 2.25845 12.4047 1.96891 12.0622 1.87367C12.0622 1.87367 12.0621 1.87366 12.0621 1.87365L7.23928 0.532418C7.23927 0.532415 7.23926 0.532412 7.23925 0.532409C7.23923 0.532403 7.2392 0.532396 7.23918 0.53239C7.08271 0.48886 6.91744 0.488896 6.76105 0.53239C6.76105 0.532391 6.76105 0.532391 6.76104 0.532392L1.9381 1.87365L12.7068 2.61025ZM6.18973 7.45765L6.54328 7.81121L6.89684 7.45765L9.42919 4.92524L9.68054 5.17659L6.54328 8.31385L4.66178 6.43236L4.91311 6.18103L6.18973 7.45765ZM9.35279 4.84885L9.35291 4.84897C9.35287 4.84893 9.35283 4.84889 9.35279 4.84885ZM4.58551 6.35608C4.58553 6.3561 4.58554 6.35611 4.58555 6.35612L4.58551 6.35608ZM4.83678 6.1047L4.83684 6.10476C4.83682 6.10474 4.8368 6.10472 4.83678 6.1047Z" fill="#35AD17" stroke="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,10 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0)">
<path d="M14.9488 2.23878C14.92 2.03249 14.7716 1.8628 14.571 1.80702L8.14028 0.018649C8.04861 -0.00686737 7.95177 -0.00686737 7.86002 0.018649L1.42935 1.80702C1.2287 1.8628 1.08028 2.03242 1.05155 2.23878C1.01425 2.50698 0.16336 8.84396 2.34584 11.9964C4.52575 15.1451 7.74157 15.952 7.87738 15.9848C7.91775 15.9946 7.95888 15.9994 8.00015 15.9994C8.04143 15.9994 8.08256 15.9945 8.12292 15.9848C8.2588 15.952 11.4746 15.1451 13.6545 11.9964C15.8369 8.84402 14.9861 2.50705 14.9488 2.23878ZM12.1471 5.93837L7.76075 10.3247C7.65868 10.4268 7.52482 10.4779 7.39104 10.4779C7.25725 10.4779 7.1234 10.4269 7.02133 10.3247L4.30928 7.61269C4.21119 7.51467 4.15611 7.38165 4.15611 7.24298C4.15611 7.10431 4.21126 6.97129 4.30928 6.87327L4.84777 6.33478C5.05197 6.13065 5.38306 6.13058 5.58719 6.33478L7.39104 8.13863L10.8692 4.66039C10.9672 4.5623 11.1002 4.50722 11.2389 4.50722C11.3776 4.50722 11.5106 4.5623 11.6086 4.66039L12.1471 5.19888C12.3513 5.40308 12.3513 5.73417 12.1471 5.93837Z" fill="#657077"/>
</g>
<defs>
<clipPath id="clip0">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11.2116 1.67921C11.19 1.52449 11.0787 1.39722 10.9282 1.35539L6.10521 0.0141088C6.03646 -0.00502845 5.96383 -0.00502845 5.89502 0.0141088L1.07201 1.35539C0.921527 1.39722 0.810207 1.52444 0.788664 1.67921C0.76069 1.88036 0.12252 6.63309 1.75938 8.99743C3.39431 11.3589 5.80618 11.9641 5.90804 11.9887C5.93831 11.9961 5.96916 11.9997 6.00012 11.9997C6.03107 11.9997 6.06192 11.996 6.09219 11.9887C6.1941 11.9641 8.60597 11.3589 10.2408 8.99743C11.8777 6.63314 11.2395 1.88041 11.2116 1.67921ZM9.11034 4.4539L5.82056 7.74368C5.74401 7.82023 5.64362 7.85855 5.54328 7.85855C5.44294 7.85855 5.34255 7.82028 5.266 7.74368L3.23196 5.70964C3.15839 5.63612 3.11708 5.53636 3.11708 5.43236C3.11708 5.32836 3.15844 5.22859 3.23196 5.15508L3.63583 4.75121C3.78898 4.59811 4.03729 4.59806 4.19039 4.75121L5.54328 6.1041L8.15191 3.49542C8.22542 3.42185 8.32519 3.38054 8.42919 3.38054C8.53319 3.38054 8.63295 3.42185 8.70647 3.49542L9.11034 3.89929C9.26349 4.05244 9.26349 4.30075 9.11034 4.4539Z" fill="#35AD17"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB