Merge branch 'develop' into feature/ads-banner

This commit is contained in:
Viktor Fomin 2024-02-02 14:38:53 +03:00
commit f9bbf35e40
16 changed files with 53 additions and 128 deletions

View File

@ -192,5 +192,7 @@
"WithSubfolders": "With subfolders", "WithSubfolders": "With subfolders",
"YouLeftTheRoom": "You have left the room", "YouLeftTheRoom": "You have left the room",
"LinkSettings": "Link settings", "LinkSettings": "Link settings",
"FileDownloadingIsRestricted": "File downloading is restricted in this room." "FileDownloadingIsRestricted": "File downloading is restricted in this room.",
"RoomEmptyAtTheMoment": "This room is empty at the moment.",
"FilesWillAppearHere": "Files and folders added to the room will appear here."
} }

View File

@ -64,6 +64,7 @@ const RootFolderContainer = (props) => {
myFolder, myFolder,
roomsFolder, roomsFolder,
isPublicRoom,
} = props; } = props;
const personalDescription = t("EmptyFolderDecription"); const personalDescription = t("EmptyFolderDecription");
@ -77,10 +78,16 @@ const RootFolderContainer = (props) => {
const favoritesDescription = t("FavoritesEmptyContainerDescription"); const favoritesDescription = t("FavoritesEmptyContainerDescription");
const recentDescription = t("RecentViaLinkEmptyContainerDescription"); const recentDescription = t("RecentViaLinkEmptyContainerDescription");
const roomsDescription = const roomsDescription = isPublicRoom ? (
isVisitor || isCollaborator <>
? t("RoomEmptyContainerDescriptionUser") <div>{t("RoomEmptyAtTheMoment")}</div>
: t("RoomEmptyContainerDescription"); <div>{t("FilesWillAppearHere")}</div>
</>
) : isVisitor || isCollaborator ? (
t("RoomEmptyContainerDescriptionUser")
) : (
t("RoomEmptyContainerDescription")
);
const archiveRoomsDescription = const archiveRoomsDescription =
isVisitor || isCollaborator isVisitor || isCollaborator
? t("ArchiveEmptyScreenUser") ? t("ArchiveEmptyScreenUser")
@ -338,6 +345,7 @@ export default inject(
selectedFolderStore, selectedFolderStore,
clientLoadingStore, clientLoadingStore,
userStore, userStore,
publicRoomStore,
}) => { }) => {
const { isDesktopClient, isEncryptionSupport, organizationName, theme } = const { isDesktopClient, isEncryptionSupport, organizationName, theme } =
settingsStore; settingsStore;
@ -353,6 +361,8 @@ export default inject(
const { isPrivacyFolder, myFolderId, myFolder, roomsFolder } = const { isPrivacyFolder, myFolderId, myFolder, roomsFolder } =
treeFoldersStore; treeFoldersStore;
const { isPublicRoom } = publicRoomStore;
return { return {
theme, theme,
isPrivacyFolder, isPrivacyFolder,
@ -375,6 +385,7 @@ export default inject(
myFolder, myFolder,
roomsFolder, roomsFolder,
isPublicRoom,
}; };
} }
)(withTranslation(["Files"])(observer(RootFolderContainer))); )(withTranslation(["Files"])(observer(RootFolderContainer)));

View File

@ -26,6 +26,8 @@ const EmptyContainer = ({
isRoomNotFoundOrMoved, isRoomNotFoundOrMoved,
isGracePeriod, isGracePeriod,
setInviteUsersWarningDialogVisible, setInviteUsersWarningDialogVisible,
isRoot,
isPublicRoom,
}) => { }) => {
//const location = useLocation(); //const location = useLocation();
@ -64,7 +66,8 @@ const EmptyContainer = ({
); );
} }
const isRootEmptyPage = parentId === 0; const isRootEmptyPage = parentId === 0 || (isPublicRoom && isRoot);
//isLoading && location?.state ? location.state?.isRoot : parentId === 0; //isLoading && location?.state ? location.state?.isRoot : parentId === 0;
return isFiltered ? ( return isFiltered ? (
@ -95,6 +98,7 @@ export default inject(
selectedFolderStore, selectedFolderStore,
clientLoadingStore, clientLoadingStore,
currentTariffStatusStore, currentTariffStatusStore,
publicRoomStore,
}) => { }) => {
const { isErrorRoomNotAvailable, isFiltered } = filesStore; const { isErrorRoomNotAvailable, isFiltered } = filesStore;
const { isLoading } = clientLoadingStore; const { isLoading } = clientLoadingStore;
@ -102,12 +106,15 @@ export default inject(
const { isGracePeriod } = currentTariffStatusStore; const { isGracePeriod } = currentTariffStatusStore;
const { setInviteUsersWarningDialogVisible } = dialogsStore; const { setInviteUsersWarningDialogVisible } = dialogsStore;
const { isPublicRoom } = publicRoomStore;
const isRoomNotFoundOrMoved = const isRoomNotFoundOrMoved =
isFiltered === null && isFiltered === null &&
selectedFolderStore.parentId === null && selectedFolderStore.parentId === null &&
isErrorRoomNotAvailable; isErrorRoomNotAvailable;
const isRoot = selectedFolderStore.pathParts?.length === 1;
return { return {
theme: settingsStore.theme, theme: settingsStore.theme,
isFiltered, isFiltered,
@ -118,6 +125,8 @@ export default inject(
isGracePeriod, isGracePeriod,
setInviteUsersWarningDialogVisible, setInviteUsersWarningDialogVisible,
type: selectedFolderStore.type, type: selectedFolderStore.type,
isRoot,
isPublicRoom,
}; };
} }
)(observer(EmptyContainer)); )(observer(EmptyContainer));

View File

@ -26,7 +26,6 @@ import {
SubmitToFormGallery, SubmitToFormGallery,
UnsavedChangesDialog, UnsavedChangesDialog,
DeleteLinkDialog, DeleteLinkDialog,
RoomSharingDialog,
MoveToPublicRoom, MoveToPublicRoom,
BackupToPublicRoom, BackupToPublicRoom,
SettingsPluginDialog, SettingsPluginDialog,
@ -80,7 +79,6 @@ const Panels = (props) => {
unsavedChangesDialogVisible, unsavedChangesDialogVisible,
deleteLinkDialogVisible, deleteLinkDialogVisible,
embeddingPanelIsVisible, embeddingPanelIsVisible,
roomSharingPanelVisible,
moveToPublicRoomVisible, moveToPublicRoomVisible,
backupToPublicRoomVisible, backupToPublicRoomVisible,
settingsPluginDialogVisible, settingsPluginDialogVisible,
@ -182,7 +180,6 @@ const Panels = (props) => {
), ),
deleteLinkDialogVisible && <DeleteLinkDialog key="delete-link-dialog" />, deleteLinkDialogVisible && <DeleteLinkDialog key="delete-link-dialog" />,
embeddingPanelIsVisible && <EmbeddingPanel key="embedding-panel" />, embeddingPanelIsVisible && <EmbeddingPanel key="embedding-panel" />,
roomSharingPanelVisible && <RoomSharingDialog key="room-sharing-dialog" />,
moveToPublicRoomVisible && ( moveToPublicRoomVisible && (
<MoveToPublicRoom key="move-to-public-room-panel" /> <MoveToPublicRoom key="move-to-public-room-panel" />
), ),
@ -241,7 +238,6 @@ export default inject(
editLinkPanelIsVisible, editLinkPanelIsVisible,
deleteLinkDialogVisible, deleteLinkDialogVisible,
embeddingPanelIsVisible, embeddingPanelIsVisible,
roomSharingPanelVisible,
moveToPublicRoomVisible, moveToPublicRoomVisible,
backupToPublicRoomVisible, backupToPublicRoomVisible,
leaveRoomDialogVisible, leaveRoomDialogVisible,
@ -298,7 +294,6 @@ export default inject(
unsavedChangesDialogVisible, unsavedChangesDialogVisible,
deleteLinkDialogVisible, deleteLinkDialogVisible,
embeddingPanelIsVisible, embeddingPanelIsVisible,
roomSharingPanelVisible,
moveToPublicRoomVisible, moveToPublicRoomVisible,
backupToPublicRoomVisible, backupToPublicRoomVisible,
settingsPluginDialogVisible, settingsPluginDialogVisible,

View File

@ -1,79 +0,0 @@
import React from "react";
import { inject, observer } from "mobx-react";
import styled from "styled-components";
import { withTranslation } from "react-i18next";
import { toastr } from "@docspace/shared/components/toast";
import { ModalDialog } from "@docspace/shared/components/modal-dialog";
import { Button } from "@docspace/shared/components/button";
import { TextInput } from "@docspace/shared/components/text-input";
import copy from "copy-to-clipboard";
import { getCorrectFourValuesStyle } from "@docspace/shared/utils";
const StyledDeleteDialog = styled(ModalDialog)`
.modal-dialog-content-body {
display: flex;
gap: 12px;
.modal-dialog-content-body_text-input {
color: #a3a9ae;
}
}
.modal-dialog-aside-header {
margin: ${({ theme }) =>
getCorrectFourValuesStyle("0 -24px 0 -16px", theme.interfaceDirection)};
padding: ${({ theme }) =>
getCorrectFourValuesStyle("0 0 0 16px", theme.interfaceDirection)};
}
`;
const RoomSharingDialog = ({ t, tReady, visible, setIsVisible }) => {
const roomHref = window.location.href;
const onClose = () => {
setIsVisible(false);
};
const onCopy = () => {
copy(roomHref);
toastr.success(t("Translations:LinkCopySuccess"));
onClose();
};
return (
<StyledDeleteDialog isLoading={!tReady} visible={visible} onClose={onClose}>
<ModalDialog.Header>{t("Files:ShareRoom")}</ModalDialog.Header>
<ModalDialog.Body>
<div className="modal-dialog-content-body">
<TextInput
className="modal-dialog-content-body_text-input"
value={roomHref}
scale
isReadOnly
isDisabled
/>
<Button
label={t("Translations:Copy")}
size="small"
onClick={onCopy}
isLoading={!tReady}
/>
</div>
</ModalDialog.Body>
</StyledDeleteDialog>
);
};
export default inject(({ dialogsStore }) => {
const { setRoomSharingPanelVisible, roomSharingPanelVisible } = dialogsStore;
return {
visible: roomSharingPanelVisible,
setIsVisible: setRoomSharingPanelVisible,
};
})(
withTranslation(["Files", "Common", "Translations"])(
observer(RoomSharingDialog)
)
);

View File

@ -32,7 +32,6 @@ import DataReassignmentDialog from "./DataReassignmentDialog";
import SubmitToFormGallery from "./SubmitToFormGallery"; import SubmitToFormGallery from "./SubmitToFormGallery";
import UnsavedChangesDialog from "./UnsavedChangesDialog"; import UnsavedChangesDialog from "./UnsavedChangesDialog";
import DeleteLinkDialog from "./DeleteLinkDialog"; import DeleteLinkDialog from "./DeleteLinkDialog";
import RoomSharingDialog from "./RoomSharingDialog";
import MoveToPublicRoom from "./MoveToPublicRoom"; import MoveToPublicRoom from "./MoveToPublicRoom";
import BackupToPublicRoom from "./BackupToPublicRoom"; import BackupToPublicRoom from "./BackupToPublicRoom";
import SettingsPluginDialog from "./SettingsPluginDialog"; import SettingsPluginDialog from "./SettingsPluginDialog";
@ -76,7 +75,6 @@ export {
SubmitToFormGallery, SubmitToFormGallery,
UnsavedChangesDialog, UnsavedChangesDialog,
DeleteLinkDialog, DeleteLinkDialog,
RoomSharingDialog,
MoveToPublicRoom, MoveToPublicRoom,
BackupToPublicRoom, BackupToPublicRoom,
SettingsPluginDialog, SettingsPluginDialog,

View File

@ -30,6 +30,7 @@ import PublicRoomIconUrl from "PUBLIC_DIR/images/public-room.react.svg?url";
import PluginMoreReactSvgUrl from "PUBLIC_DIR/images/plugin.more.react.svg?url"; import PluginMoreReactSvgUrl from "PUBLIC_DIR/images/plugin.more.react.svg?url";
import LeaveRoomSvgUrl from "PUBLIC_DIR/images/logout.react.svg?url"; import LeaveRoomSvgUrl from "PUBLIC_DIR/images/logout.react.svg?url";
import CatalogRoomsReactSvgUrl from "PUBLIC_DIR/images/catalog.rooms.react.svg?url"; import CatalogRoomsReactSvgUrl from "PUBLIC_DIR/images/catalog.rooms.react.svg?url";
import TabletLinkReactSvgUrl from "PUBLIC_DIR/images/tablet-link.reat.svg?url";
import React from "react"; import React from "react";
import { inject, observer } from "mobx-react"; import { inject, observer } from "mobx-react";
@ -237,7 +238,6 @@ const SectionHeaderContent = (props) => {
isPublicRoom, isPublicRoom,
theme, theme,
whiteLabelLogoUrls, whiteLabelLogoUrls,
setRoomSharingPanelVisible,
downloadAction, downloadAction,
isPublicRoomType, isPublicRoomType,
isCustomRoomType, isCustomRoomType,
@ -599,7 +599,8 @@ const SectionHeaderContent = (props) => {
}; };
const onShareRoom = () => { const onShareRoom = () => {
setRoomSharingPanelVisible(true); copy(window.location.href);
toastr.success(t("Translations:LinkCopySuccess"));
}; };
const getContextOptionsFolder = () => { const getContextOptionsFolder = () => {
@ -628,22 +629,18 @@ const SectionHeaderContent = (props) => {
if (isPublicRoom) { if (isPublicRoom) {
return [ return [
security?.Download && {
key: "public-room_edit",
label: t("Files:DownloadAll"),
icon: DownloadReactSvgUrl,
onClick: onDownloadAll,
},
security?.Download && {
key: "public-room_separator",
isSeparator: true,
},
{ {
key: "public-room_share", key: "public-room_share",
label: t("Files:ShareRoom"), label: t("Files:CopyLink"),
icon: ShareReactSvgUrl, icon: TabletLinkReactSvgUrl,
onClick: onShareRoom, onClick: onShareRoom,
}, },
security?.Download && {
key: "public-room_edit",
label: t("Common:Download"),
icon: DownloadReactSvgUrl,
onClick: onDownloadAll,
},
]; ];
} }
@ -1227,7 +1224,6 @@ export default inject(
setRestoreAllArchive, setRestoreAllArchive,
setInvitePanelOptions, setInvitePanelOptions,
setInviteUsersWarningDialogVisible, setInviteUsersWarningDialogVisible,
setRoomSharingPanelVisible,
setLeaveRoomDialogVisible, setLeaveRoomDialogVisible,
} = dialogsStore; } = dialogsStore;
@ -1459,7 +1455,6 @@ export default inject(
categoryType, categoryType,
theme, theme,
whiteLabelLogoUrls, whiteLabelLogoUrls,
setRoomSharingPanelVisible,
isFrame, isFrame,
currentDeviceType, currentDeviceType,
setLeaveRoomDialogVisible, setLeaveRoomDialogVisible,

View File

@ -6,7 +6,6 @@ import SectionHeaderContent from "../Home/Section/Header";
import SectionFilterContent from "../Home/Section/Filter"; import SectionFilterContent from "../Home/Section/Filter";
import FilesPanels from "../../components/FilesPanels"; import FilesPanels from "../../components/FilesPanels";
import SectionWrapper from "SRC_DIR/components/Section"; import SectionWrapper from "SRC_DIR/components/Section";
import { RoomSharingDialog } from "../../components/dialogs";
import SelectionArea from "../Home/SelectionArea/FilesSelectionArea"; import SelectionArea from "../Home/SelectionArea/FilesSelectionArea";
import MediaViewer from "../Home/MediaViewer"; import MediaViewer from "../Home/MediaViewer";

View File

@ -11,7 +11,6 @@ class DialogsStore {
versionHistoryStore; versionHistoryStore;
infoPanelStore; infoPanelStore;
roomSharingPanelVisible = false;
ownerPanelVisible = false; ownerPanelVisible = false;
moveToPanelVisible = false; moveToPanelVisible = false;
restorePanelVisible = false; restorePanelVisible = false;
@ -117,10 +116,6 @@ class DialogsStore {
this.restoreRoomDialogVisible = visible; this.restoreRoomDialogVisible = visible;
}; };
setRoomSharingPanelVisible = (roomSharingPanelVisible) => {
this.roomSharingPanelVisible = roomSharingPanelVisible;
};
setIsFolderActions = (isFolderActions) => { setIsFolderActions = (isFolderActions) => {
this.isFolderActions = isFolderActions; this.isFolderActions = isFolderActions;
}; };

View File

@ -929,21 +929,21 @@ class UploadDataStore {
if (!this.isParallel) { if (!this.isParallel) {
uploadedSize = uploaded uploadedSize = uploaded
? fileSize ? fileSize
: index * this.settingsStore.chunkUploadSize; : index * this.filesSettingsStore.chunkUploadSize;
newPercent = this.getNewPercent(uploadedSize, indexOfFile); newPercent = this.getNewPercent(uploadedSize, indexOfFile);
} else { } else {
if (!uploaded) { if (!uploaded) {
uploadedSize = uploadedSize =
fileSize <= this.settingsStore.chunkUploadSize fileSize <= this.filesSettingsStore.chunkUploadSize
? fileSize ? fileSize
: this.settingsStore.chunkUploadSize; : this.filesSettingsStore.chunkUploadSize;
} else { } else {
uploadedSize = isFinalize uploadedSize = isFinalize
? 0 ? 0
: fileSize <= this.settingsStore.chunkUploadSize : fileSize <= this.filesSettingsStore.chunkUploadSize
? fileSize ? fileSize
: fileSize - index * this.settingsStore.chunkUploadSize; : fileSize - index * this.filesSettingsStore.chunkUploadSize;
} }
newPercent = this.getFilesPercent(uploadedSize); newPercent = this.getFilesPercent(uploadedSize);
} }
@ -1132,7 +1132,7 @@ class UploadDataStore {
operationId, operationId,
toFolderId toFolderId
) => { ) => {
const { chunkUploadCount: asyncChunkUploadCount } = this.settingsStore; const { chunkUploadCount: asyncChunkUploadCount } = this.filesSettingsStore;
const length = requestsDataArray.length; const length = requestsDataArray.length;
const isThirdPartyFolder = typeof toFolderId === "string"; const isThirdPartyFolder = typeof toFolderId === "string";
@ -1228,7 +1228,7 @@ class UploadDataStore {
// console.log("IS PARALLEL"); // console.log("IS PARALLEL");
const notUploadedFiles = this.files.filter((f) => !f.inAction); const notUploadedFiles = this.files.filter((f) => !f.inAction);
const { chunkUploadCount } = this.settingsStore; const { chunkUploadCount } = this.filesSettingsStore;
const countFiles = const countFiles =
notUploadedFiles.length >= chunkUploadCount notUploadedFiles.length >= chunkUploadCount

View File

@ -19,10 +19,12 @@ const StyledContainer = styled.div<{
withLogo: boolean; withLogo: boolean;
isDesktopClient?: boolean; isDesktopClient?: boolean;
width?: number; width?: number;
isPublicRoom?: boolean;
}>` }>`
${(props) => ${(props) =>
!props.isDropBoxComponent && !props.isDropBoxComponent &&
props.isDesktop && props.isDesktop &&
!props.isPublicRoom &&
css` css`
width: 100%; width: 100%;
max-width: 100%; max-width: 100%;

View File

@ -225,6 +225,7 @@ const Navigation = ({
isDesktopClient={isDesktopClient} isDesktopClient={isDesktopClient}
isInfoPanelVisible={isInfoPanelVisible} isInfoPanelVisible={isInfoPanelVisible}
withLogo={!!withLogo} withLogo={!!withLogo}
isPublicRoom={isPublicRoom}
className="navigation-container" className="navigation-container"
> >
{withLogo && ( {withLogo && (

View File

@ -51,7 +51,7 @@ const ContextButton = ({
/> />
<ContextMenu <ContextMenu
model={model} model={model}
containerRef={ref} // containerRef={ref}
ref={menuRef} ref={menuRef}
onHide={onHide} onHide={onHide}
scaled={false} scaled={false}

View File

@ -169,4 +169,3 @@
"react-dom": "^18.2.0" "react-dom": "^18.2.0"
} }
} }

View File

@ -390,7 +390,7 @@ class AuthStore {
return ( return (
this.settingsStore?.isLoaded && this.settingsStore?.isLoaded &&
!!this.settingsStore?.socketUrl && !!this.settingsStore?.socketUrl &&
!this.settingsStore?.isPublicRoom !isPublicRoom()
// || //this.userStore.isAuthenticated // || //this.userStore.isAuthenticated
); );
} }

View File

@ -23,7 +23,7 @@ import {
} from "../api/settings/types"; } from "../api/settings/types";
import { TUser } from "../api/people/types"; import { TUser } from "../api/people/types";
import { size as deviceSize, isTablet, getSystemTheme } from "../utils"; import { size as deviceSize, isTablet, getSystemTheme } from "../utils";
import { frameCallEvent, getShowText } from "../utils/common"; import { frameCallEvent, getShowText, isPublicRoom } from "../utils/common";
import { setCookie, getCookie } from "../utils/cookie"; import { setCookie, getCookie } from "../utils/cookie";
import { combineUrl } from "../utils/combineUrl"; import { combineUrl } from "../utils/combineUrl";
import FirebaseHelper from "../utils/firebase"; import FirebaseHelper from "../utils/firebase";
@ -185,8 +185,6 @@ class SettingsStore {
hasShortenService = false; hasShortenService = false;
isPublicRoom = false;
withPaging = false; withPaging = false;
customSchemaList: TCustomSchema[] = []; customSchemaList: TCustomSchema[] = [];
@ -828,7 +826,7 @@ class SettingsStore {
get socketHelper() { get socketHelper() {
const socketUrl = const socketUrl =
this.isPublicRoom && !this.publicRoomKey ? "" : this.socketUrl; isPublicRoom() && !this.publicRoomKey ? "" : this.socketUrl;
return new SocketIOHelper(socketUrl, this.publicRoomKey); return new SocketIOHelper(socketUrl, this.publicRoomKey);
} }