Merge branch 'feature/VDR-room' into feature/VDR-indexing
# Conflicts: # packages/client/src/pages/Home/Section/Body/RowsView/FilesRowContent.js # packages/client/src/pages/Home/Section/Header/index.js # packages/client/src/store/ContextOptionsStore.js
This commit is contained in:
commit
d950c5557f
3
.github/codeql/config-codeql.yml
vendored
3
.github/codeql/config-codeql.yml
vendored
@ -1,3 +0,0 @@
|
||||
---
|
||||
paths:
|
||||
- ./**
|
1
.github/workflows/codeql.yaml
vendored
1
.github/workflows/codeql.yaml
vendored
@ -56,7 +56,6 @@ jobs:
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
config-file: .github/codeql/config-codeql.yml
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docspace",
|
||||
"version": "2.5.1",
|
||||
"version": "2.6.0",
|
||||
"private": true,
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@docspace/client",
|
||||
"version": "2.5.1",
|
||||
"version": "2.6.0",
|
||||
"private": true,
|
||||
"homepage": "",
|
||||
"scripts": {
|
||||
|
@ -6,7 +6,6 @@
|
||||
"Width": "Width",
|
||||
"Link": "Link",
|
||||
"DisplaySettings": "Display settings",
|
||||
"EmbeddingDescription": "Embed Public room into your website or blog. Apply additional display settings for customizing the embedded content.",
|
||||
"CodeSuccessfullyCopied": "Code to insert successfully copied to clipboard",
|
||||
"LinkProtectedWithPassword": "The link is protected with a password.",
|
||||
"ContentRestricted": "Content copying, file downloading and printing are restricted.",
|
||||
|
@ -57,11 +57,6 @@ const StyledBody = styled.div`
|
||||
}
|
||||
|
||||
.embedding-panel_body {
|
||||
.embedding-panel_description {
|
||||
color: ${({ theme }) => theme.embeddingPanel.descriptionTextColor};
|
||||
margin: 18px 0;
|
||||
}
|
||||
|
||||
.embedding-panel_bar {
|
||||
.embedding-panel_bar-header {
|
||||
display: flex;
|
||||
|
@ -26,11 +26,12 @@
|
||||
|
||||
import { useState, useEffect, useCallback, useRef } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { withTranslation, Trans } from "react-i18next";
|
||||
import copy from "copy-to-clipboard";
|
||||
import isEqual from "lodash/isEqual";
|
||||
import { objectToGetParams } from "@docspace/shared/utils/common";
|
||||
import { combineUrl } from "@docspace/shared/utils/combineUrl";
|
||||
import config from "PACKAGE_FILE";
|
||||
|
||||
import { Text } from "@docspace/shared/components/text";
|
||||
import { toastr } from "@docspace/shared/components/toast";
|
||||
@ -103,7 +104,7 @@ type EmbeddingPanelProps = {
|
||||
visible: boolean;
|
||||
setEmbeddingPanelData: (value: {
|
||||
visible: boolean;
|
||||
fileId?: string | number;
|
||||
itemId?: string | number;
|
||||
}) => void;
|
||||
setEditLinkPanelIsVisible: (value: boolean) => void;
|
||||
currentColorScheme: TColorScheme;
|
||||
@ -111,7 +112,8 @@ type EmbeddingPanelProps = {
|
||||
setLinkParams: (linkParams: LinkParamsType) => void;
|
||||
fetchExternalLinks: (roomId: string | number) => LinkParamsLinkType[];
|
||||
isAdmin: boolean;
|
||||
fileId?: string | number;
|
||||
itemId?: string | number;
|
||||
isRoom: boolean;
|
||||
};
|
||||
|
||||
type TOptionType = TOption & {
|
||||
@ -130,18 +132,17 @@ const EmbeddingPanelComponent = (props: EmbeddingPanelProps) => {
|
||||
setLinkParams,
|
||||
fetchExternalLinks,
|
||||
isAdmin,
|
||||
fileId,
|
||||
itemId,
|
||||
isRoom,
|
||||
} = props;
|
||||
|
||||
const { roomId, link } = linkParams;
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [sharedLinksOptions, setSharedLinksOptions] = useState<TOptionType[]>(
|
||||
[],
|
||||
);
|
||||
const [selectedLink, setSelectedLink] = useState<TOptionType>();
|
||||
const [barIsVisible, setBarIsVisible] = useState(!!fileId);
|
||||
const [barIsVisible, setBarIsVisible] = useState(true);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const dataDimensions = [
|
||||
@ -164,7 +165,7 @@ const EmbeddingPanelComponent = (props: EmbeddingPanelProps) => {
|
||||
height: `${heightValue}${dataDimensions[1].label}`,
|
||||
frameId: "ds-frame",
|
||||
init: true,
|
||||
id: fileId,
|
||||
id: itemId,
|
||||
};
|
||||
|
||||
const roomConfig = {
|
||||
@ -190,10 +191,14 @@ const EmbeddingPanelComponent = (props: EmbeddingPanelProps) => {
|
||||
},
|
||||
};
|
||||
|
||||
const [config, setConfig] = useState(fileId ? fileConfig : roomConfig);
|
||||
const isFile = itemId && !isRoom;
|
||||
|
||||
const params = objectToGetParams(config);
|
||||
const codeBlock = `<div id="${config.frameId}">Fallback text</div>\n<script src="${SDK_SCRIPT_URL}${params}"></script>`;
|
||||
const [embeddingConfig, setEmbeddingConfig] = useState(
|
||||
isFile ? fileConfig : roomConfig,
|
||||
);
|
||||
|
||||
const params = objectToGetParams(embeddingConfig);
|
||||
const codeBlock = `<div id="${embeddingConfig.frameId}">Fallback text</div>\n<script src="${SDK_SCRIPT_URL}${params}"></script>`;
|
||||
|
||||
const currentLink = selectedLink ?? link;
|
||||
|
||||
@ -217,7 +222,7 @@ const EmbeddingPanelComponent = (props: EmbeddingPanelProps) => {
|
||||
}
|
||||
|
||||
const showLinkBar =
|
||||
selectedLink?.sharedTo?.password || selectedLink?.sharedTo?.denyDownload;
|
||||
currentLink?.sharedTo?.password || currentLink?.sharedTo?.denyDownload;
|
||||
|
||||
const onClose = () => {
|
||||
setEmbeddingPanelData({ visible: false });
|
||||
@ -225,28 +230,28 @@ const EmbeddingPanelComponent = (props: EmbeddingPanelProps) => {
|
||||
|
||||
const onChangeWidth = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
setWidthValue(e.target.value);
|
||||
setConfig((config) => {
|
||||
setEmbeddingConfig((config) => {
|
||||
return { ...config, width: `${e.target.value}${widthDimension.label}` };
|
||||
});
|
||||
};
|
||||
|
||||
const onChangeHeight = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
setHeightValue(e.target.value);
|
||||
setConfig((config) => {
|
||||
setEmbeddingConfig((config) => {
|
||||
return { ...config, height: `${e.target.value}${heightDimension.label}` };
|
||||
});
|
||||
};
|
||||
|
||||
const onChangeWidthDimension = (item: TOption) => {
|
||||
setWidthDimension(item);
|
||||
setConfig((config) => {
|
||||
setEmbeddingConfig((config) => {
|
||||
return { ...config, width: `${widthValue}${item.label}` };
|
||||
});
|
||||
};
|
||||
|
||||
const onChangeHeightDimension = (item: TOption) => {
|
||||
setHeightDimension(item);
|
||||
setConfig((config) => {
|
||||
setEmbeddingConfig((config) => {
|
||||
return { ...config, height: `${heightValue}${item.label}` };
|
||||
});
|
||||
};
|
||||
@ -257,13 +262,13 @@ const EmbeddingPanelComponent = (props: EmbeddingPanelProps) => {
|
||||
};
|
||||
|
||||
const onHeaderChange = () => {
|
||||
setConfig((config) => {
|
||||
setEmbeddingConfig((config) => {
|
||||
return { ...config, showTitle: !config.showTitle };
|
||||
});
|
||||
};
|
||||
|
||||
const onTitleChange = () => {
|
||||
setConfig((config) => {
|
||||
setEmbeddingConfig((config) => {
|
||||
return { ...config, showFilter: !config.showFilter };
|
||||
});
|
||||
};
|
||||
@ -280,7 +285,7 @@ const EmbeddingPanelComponent = (props: EmbeddingPanelProps) => {
|
||||
|
||||
const onChangeSharedLink = (item: TOptionType) => {
|
||||
setSelectedLink(item);
|
||||
setConfig((config) => {
|
||||
setEmbeddingConfig((config) => {
|
||||
return { ...config, requestToken: item?.sharedTo?.requestToken };
|
||||
});
|
||||
};
|
||||
@ -290,8 +295,14 @@ const EmbeddingPanelComponent = (props: EmbeddingPanelProps) => {
|
||||
};
|
||||
|
||||
const onOpenDevTools = () => {
|
||||
navigate("/portal-settings/developer-tools");
|
||||
onClose();
|
||||
const url = combineUrl(
|
||||
window.location.origin,
|
||||
window.ClientConfig?.proxy?.url,
|
||||
config.homepage,
|
||||
"/portal-settings/developer-tools",
|
||||
);
|
||||
|
||||
window.open(url, "_blank");
|
||||
};
|
||||
|
||||
const onKeyPress = (e: KeyboardEvent) => {
|
||||
@ -332,10 +343,10 @@ const EmbeddingPanelComponent = (props: EmbeddingPanelProps) => {
|
||||
}, [roomId, fetchExternalLinks]);
|
||||
|
||||
useEffect(() => {
|
||||
if (fileId) {
|
||||
if (itemId) {
|
||||
getLinks();
|
||||
}
|
||||
}, [fileId, getLinks]);
|
||||
}, [itemId, getLinks]);
|
||||
|
||||
const usePrevious = (value: LinkParamsLinkType | null) => {
|
||||
const ref = useRef<LinkParamsLinkType | null>();
|
||||
@ -393,6 +404,7 @@ const EmbeddingPanelComponent = (props: EmbeddingPanelProps) => {
|
||||
<StyledModalDialog
|
||||
visible={visible}
|
||||
onClose={onClose}
|
||||
withBodyScroll
|
||||
displayType={ModalDialogType.aside}
|
||||
>
|
||||
<ModalDialog.Header>{t("Files:EmbeddingSettings")}</ModalDialog.Header>
|
||||
@ -431,12 +443,6 @@ const EmbeddingPanelComponent = (props: EmbeddingPanelProps) => {
|
||||
</div>
|
||||
)}
|
||||
<div className="embedding-panel_body">
|
||||
{!fileId && (
|
||||
<Text fontSize="12px" className="embedding-panel_description">
|
||||
{t("EmbeddingPanel:EmbeddingDescription")}
|
||||
</Text>
|
||||
)}
|
||||
|
||||
{sharedLinksOptions && sharedLinksOptions.length > 1 && (
|
||||
<>
|
||||
<Text
|
||||
@ -492,7 +498,7 @@ const EmbeddingPanelComponent = (props: EmbeddingPanelProps) => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{!fileId && (
|
||||
{!isFile && (
|
||||
<>
|
||||
<Text
|
||||
className="embedding-panel_header-text"
|
||||
@ -506,7 +512,7 @@ const EmbeddingPanelComponent = (props: EmbeddingPanelProps) => {
|
||||
<CheckboxElement
|
||||
label={t("Common:Title")}
|
||||
onChange={onHeaderChange}
|
||||
isChecked={config.showTitle}
|
||||
isChecked={embeddingConfig.showTitle}
|
||||
img={theme.isBase ? HeaderUrl : HeaderDarkUrl}
|
||||
title={t("JavascriptSdk:Header")}
|
||||
description={t("JavascriptSdk:HeaderDescription")}
|
||||
@ -514,7 +520,7 @@ const EmbeddingPanelComponent = (props: EmbeddingPanelProps) => {
|
||||
<CheckboxElement
|
||||
label={t("JavascriptSdk:SearchFilterAndSort")}
|
||||
onChange={onTitleChange}
|
||||
isChecked={config.showFilter}
|
||||
isChecked={embeddingConfig.showFilter}
|
||||
img={theme.isBase ? SearchUrl : SearchDarkUrl}
|
||||
title={t("JavascriptSdk:SearchBlock")}
|
||||
description={t(
|
||||
@ -567,18 +573,8 @@ const EmbeddingPanelComponent = (props: EmbeddingPanelProps) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(
|
||||
({
|
||||
dialogsStore,
|
||||
settingsStore,
|
||||
userStore,
|
||||
publicRoomStore,
|
||||
}: {
|
||||
dialogsStore: DialogsStore;
|
||||
settingsStore: SettingsStore;
|
||||
userStore: UserStore;
|
||||
publicRoomStore: PublicRoomStore;
|
||||
}) => {
|
||||
export default inject<TStore>(
|
||||
({ dialogsStore, settingsStore, userStore, publicRoomStore }) => {
|
||||
const {
|
||||
embeddingPanelData,
|
||||
setEmbeddingPanelData,
|
||||
@ -594,7 +590,8 @@ export default inject(
|
||||
theme,
|
||||
currentColorScheme,
|
||||
visible: embeddingPanelData.visible,
|
||||
fileId: embeddingPanelData.fileId,
|
||||
itemId: embeddingPanelData.item?.id,
|
||||
isRoom: embeddingPanelData.item?.isRoom,
|
||||
setEmbeddingPanelData,
|
||||
setEditLinkPanelIsVisible,
|
||||
linkParams,
|
||||
|
@ -24,16 +24,13 @@
|
||||
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
|
||||
import { useRef, useEffect } from "react";
|
||||
import { useRef } from "react";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import styled from "styled-components";
|
||||
import { ContextMenu } from "@docspace/shared/components/context-menu";
|
||||
import { ContextMenuButton } from "@docspace/shared/components/context-menu-button";
|
||||
|
||||
const generalKeys = ["select", "show-info"];
|
||||
const roomKeys = ["separator0", "room-info"];
|
||||
|
||||
const StyledItemContextOptions = styled.div`
|
||||
height: 16px;
|
||||
margin: ${({ theme }) =>
|
||||
@ -45,7 +42,6 @@ const RoomsContextBtn = ({
|
||||
selection,
|
||||
itemTitleRef,
|
||||
|
||||
getItemContextOptionsKeys,
|
||||
getItemContextOptionsActions,
|
||||
onSelectItem,
|
||||
}) => {
|
||||
@ -62,37 +58,7 @@ const RoomsContextBtn = ({
|
||||
};
|
||||
|
||||
const getData = () => {
|
||||
let item = { ...selection };
|
||||
if (!selection.contextOptions) {
|
||||
const contextOptions = getItemContextOptionsKeys(selection, true);
|
||||
item = { ...item, contextOptions };
|
||||
}
|
||||
|
||||
const options = getItemContextOptionsActions(item, t, true);
|
||||
|
||||
const removeOptionByKey = (key) => {
|
||||
const idx = options.findIndex((o) => o.key === key);
|
||||
if (idx !== -1) options.splice(idx, 1);
|
||||
};
|
||||
|
||||
generalKeys.forEach((key) => removeOptionByKey(key));
|
||||
if (selection.isRoom) roomKeys.forEach((key) => removeOptionByKey(key));
|
||||
|
||||
options.forEach((item, index) => {
|
||||
const isSeparator = item.key.includes("separator");
|
||||
const isFirst = index === options.length - 1;
|
||||
const isLast = index === 0;
|
||||
const nextItem = isLast ? null : options[index + 1];
|
||||
const nextIsSeparator = nextItem && nextItem.key.includes("separator");
|
||||
if (
|
||||
(isFirst && isSeparator) ||
|
||||
(isLast && isSeparator) ||
|
||||
(isSeparator && nextIsSeparator)
|
||||
)
|
||||
options.splice(index, 1);
|
||||
});
|
||||
|
||||
return options;
|
||||
return getItemContextOptionsActions(selection, t, true);
|
||||
};
|
||||
|
||||
return (
|
||||
@ -120,8 +86,7 @@ const RoomsContextBtn = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ filesStore, contextOptionsStore }) => ({
|
||||
getItemContextOptionsKeys: filesStore.getFilesContextOptions,
|
||||
export default inject(({ contextOptionsStore }) => ({
|
||||
getItemContextOptionsActions: contextOptionsStore.getFilesContextOptions,
|
||||
}))(
|
||||
withTranslation([
|
||||
|
@ -386,6 +386,8 @@ const InsideGroupTableRow = (props) => {
|
||||
modernView
|
||||
manualWidth={"fit-content"}
|
||||
isLoading={isLoading}
|
||||
optionStyle={{ maxWidth: "400px" }}
|
||||
textOverflow
|
||||
/>
|
||||
);
|
||||
|
||||
|
@ -390,6 +390,8 @@ const PeopleTableRow = (props) => {
|
||||
modernView
|
||||
manualWidth={"fit-content"}
|
||||
isLoading={isLoading}
|
||||
optionStyle={{ maxWidth: "400px" }}
|
||||
textOverflow
|
||||
/>
|
||||
);
|
||||
|
||||
|
@ -285,7 +285,7 @@ const FilesRowContent = ({
|
||||
return value;
|
||||
}
|
||||
|
||||
if (!fileExst && !contentLength && !providerKey && !isMobile())
|
||||
if (!fileExst && !contentLength && !providerKey)
|
||||
return `${foldersCount} ${t("Translations:Folders")} | ${filesCount} ${t(
|
||||
"Translations:Files",
|
||||
)}`;
|
||||
@ -336,16 +336,17 @@ const FilesRowContent = ({
|
||||
{`${t("Files:Index")} ${order}`}
|
||||
</Text>
|
||||
)}
|
||||
|
||||
<Text
|
||||
containerMinWidth="200px"
|
||||
containerWidth="15%"
|
||||
fontSize="12px"
|
||||
fontWeight={400}
|
||||
className="row_update-text"
|
||||
>
|
||||
{mainInfo}
|
||||
</Text>
|
||||
{mainInfo && (
|
||||
<Text
|
||||
containerMinWidth="200px"
|
||||
containerWidth="15%"
|
||||
fontSize="12px"
|
||||
fontWeight={400}
|
||||
className="row_update-text"
|
||||
>
|
||||
{mainInfo}
|
||||
</Text>
|
||||
)}
|
||||
|
||||
<Text
|
||||
containerMinWidth="90px"
|
||||
|
@ -161,6 +161,14 @@ const SectionBodyContent = (props) => {
|
||||
}
|
||||
};
|
||||
|
||||
const isHeaderOptionButton = (event) => {
|
||||
const parent = document.querySelector("#header_optional-button");
|
||||
|
||||
if (!parent || !event.target) return false;
|
||||
|
||||
return parent.contains(event.target);
|
||||
};
|
||||
|
||||
const onMouseDown = (e) => {
|
||||
if (
|
||||
(e.target.closest(".scroll-body") &&
|
||||
@ -171,7 +179,8 @@ const SectionBodyContent = (props) => {
|
||||
!e.target.closest(".document-catalog")) ||
|
||||
e.target.closest(".files-main-button") ||
|
||||
e.target.closest(".add-button") ||
|
||||
e.target.closest("#filter_search-input")
|
||||
e.target.closest("#filter_search-input") ||
|
||||
isHeaderOptionButton(e)
|
||||
) {
|
||||
setSelection([]);
|
||||
setBufferSelection(null);
|
||||
|
@ -24,63 +24,32 @@
|
||||
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
|
||||
import ClearTrashReactSvgUrl from "PUBLIC_DIR/images/clear.trash.react.svg?url";
|
||||
import ReconnectSvgUrl from "PUBLIC_DIR/images/reconnect.svg?url";
|
||||
import SettingsReactSvgUrl from "PUBLIC_DIR/images/catalog.settings.react.svg?url";
|
||||
import CopyToReactSvgUrl from "PUBLIC_DIR/images/copyTo.react.svg?url";
|
||||
import DownloadReactSvgUrl from "PUBLIC_DIR/images/download.react.svg?url";
|
||||
import MoveReactSvgUrl from "PUBLIC_DIR/images/move.react.svg?url";
|
||||
import RenameReactSvgUrl from "PUBLIC_DIR/images/rename.react.svg?url";
|
||||
import ShareReactSvgUrl from "PUBLIC_DIR/images/share.react.svg?url";
|
||||
import InvitationLinkReactSvgUrl from "PUBLIC_DIR/images/invitation.link.react.svg?url";
|
||||
import InfoOutlineReactSvgUrl from "PUBLIC_DIR/images/info.outline.react.svg?url";
|
||||
import PersonReactSvgUrl from "PUBLIC_DIR/images/person.react.svg?url";
|
||||
|
||||
import RoomArchiveSvgUrl from "PUBLIC_DIR/images/room.archive.svg?url";
|
||||
import CopyReactSvgUrl from "PUBLIC_DIR/images/copy.react.svg?url";
|
||||
import CatalogTrashReactSvgUrl from "PUBLIC_DIR/images/catalog.trash.react.svg?url";
|
||||
|
||||
import PublicRoomIconUrl from "PUBLIC_DIR/images/public-room.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 TabletLinkReactSvgUrl from "PUBLIC_DIR/images/tablet-link.react.svg?url";
|
||||
|
||||
import React from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import styled, { css } from "styled-components";
|
||||
import copy from "copy-to-clipboard";
|
||||
import { useNavigate, useLocation, useParams } from "react-router-dom";
|
||||
|
||||
import { useLocation, useParams } from "react-router-dom";
|
||||
import { SectionHeaderSkeleton } from "@docspace/shared/skeletons/sections";
|
||||
import Navigation from "@docspace/shared/components/navigation";
|
||||
import FilesFilter from "@docspace/shared/api/files/filter";
|
||||
|
||||
import { DropDownItem } from "@docspace/shared/components/drop-down-item";
|
||||
import { tablet, mobile, Consumer, getLogoUrl } from "@docspace/shared/utils";
|
||||
|
||||
import { toastr } from "@docspace/shared/components/toast";
|
||||
import { TableGroupMenu } from "@docspace/shared/components/table";
|
||||
import {
|
||||
Events,
|
||||
RoomsType,
|
||||
DeviceType,
|
||||
FolderType,
|
||||
ShareAccessRights,
|
||||
FilesSelectorFilterTypes,
|
||||
WhiteLabelLogoType,
|
||||
} from "@docspace/shared/enums";
|
||||
|
||||
import { copyShareLink } from "@docspace/shared/utils/copy";
|
||||
|
||||
import { CategoryType } from "SRC_DIR/helpers/constants";
|
||||
import {
|
||||
getCategoryTypeByFolderType,
|
||||
getCategoryUrl,
|
||||
} from "SRC_DIR/helpers/utils";
|
||||
import TariffBar from "SRC_DIR/components/TariffBar";
|
||||
import { PRODUCT_NAME } from "@docspace/shared/constants";
|
||||
import IndexMenu from "../IndexHeader";
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
@ -181,17 +150,13 @@ const StyledContainer = styled.div`
|
||||
|
||||
const SectionHeaderContent = (props) => {
|
||||
const {
|
||||
currentFolderId,
|
||||
currentGroup,
|
||||
insideGroupTempTitle,
|
||||
getGroupContextOptions,
|
||||
t,
|
||||
isRoomsFolder,
|
||||
security,
|
||||
setIsFolderActions,
|
||||
setIsIndexEditingMode,
|
||||
setBufferSelection,
|
||||
setMoveToPanelVisible,
|
||||
tReady,
|
||||
isInfoPanelVisible,
|
||||
isRootFolder,
|
||||
@ -216,27 +181,7 @@ const SectionHeaderContent = (props) => {
|
||||
isGroupMenuBlocked,
|
||||
|
||||
onClickBack,
|
||||
activeFiles,
|
||||
activeFolders,
|
||||
selectedFolder,
|
||||
setCopyPanelVisible,
|
||||
setSharingPanelVisible,
|
||||
deleteAction,
|
||||
confirmDelete,
|
||||
setDeleteDialogVisible,
|
||||
isThirdPartySelection,
|
||||
|
||||
getFolderInfo,
|
||||
|
||||
setEmptyTrashDialogVisible,
|
||||
setRestoreAllPanelVisible,
|
||||
isGracePeriod,
|
||||
setInviteUsersWarningDialogVisible,
|
||||
setReorderDialogVisible,
|
||||
setRestoreAllArchive,
|
||||
setRestoreRoomDialogVisible,
|
||||
onCopyLink,
|
||||
setShareFolderDialogVisible,
|
||||
|
||||
setSelected,
|
||||
cbMenuItems,
|
||||
@ -261,43 +206,30 @@ const SectionHeaderContent = (props) => {
|
||||
setAccountsSelected,
|
||||
setGroupsSelected,
|
||||
isRoomAdmin,
|
||||
isCollaborator,
|
||||
isEmptyPage,
|
||||
|
||||
isLoading,
|
||||
|
||||
emptyTrashInProgress,
|
||||
categoryType,
|
||||
isPublicRoom,
|
||||
isFormRoomType,
|
||||
theme,
|
||||
downloadAction,
|
||||
isPublicRoomType,
|
||||
isCustomRoomType,
|
||||
primaryLink,
|
||||
getPrimaryLink,
|
||||
setExternalLink,
|
||||
moveToPublicRoom,
|
||||
currentDeviceType,
|
||||
isFrame,
|
||||
showTitle,
|
||||
hideInfoPanel,
|
||||
onClickArchive,
|
||||
setLeaveRoomDialogVisible,
|
||||
inRoom,
|
||||
onClickCreateRoom,
|
||||
onCreateAndCopySharedLink,
|
||||
showNavigationButton,
|
||||
setSelectFileFormRoomDialogVisible,
|
||||
deleteRooms,
|
||||
setSelection,
|
||||
startUpload,
|
||||
reorder,
|
||||
getFolderModel,
|
||||
onCreateRoom,
|
||||
onEmptyTrashAction,
|
||||
getHeaderOptions,
|
||||
setBufferSelection,
|
||||
} = props;
|
||||
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const { groupId } = useParams();
|
||||
|
||||
@ -318,413 +250,20 @@ const SectionHeaderContent = (props) => {
|
||||
|
||||
const onInputClick = React.useCallback((e) => (e.target.value = null), []);
|
||||
|
||||
const createLinkForPortalUsers = () => {
|
||||
copy(
|
||||
`${window.location.origin}/filter?folder=${currentFolderId}`, //TODO: Change url by category
|
||||
);
|
||||
|
||||
toastr.success(t("Translations:LinkCopySuccess"));
|
||||
};
|
||||
|
||||
const onMoveAction = () => {
|
||||
setIsFolderActions(true);
|
||||
setBufferSelection(selectedFolder);
|
||||
return setMoveToPanelVisible(true);
|
||||
};
|
||||
|
||||
const onCopyAction = () => {
|
||||
setIsFolderActions(true);
|
||||
setBufferSelection(selectedFolder);
|
||||
return setCopyPanelVisible(true);
|
||||
};
|
||||
|
||||
const onDownloadAction = () => {
|
||||
downloadAction(t("Translations:ArchivingData"), selectedFolder, [
|
||||
currentFolderId,
|
||||
]).catch((err) => toastr.error(err));
|
||||
};
|
||||
|
||||
const onClickArchiveAction = (e) => {
|
||||
setBufferSelection(selectedFolder);
|
||||
onClickArchive(e);
|
||||
};
|
||||
|
||||
const onLeaveRoom = () => {
|
||||
setLeaveRoomDialogVisible(true);
|
||||
};
|
||||
|
||||
const renameAction = () => {
|
||||
const event = new Event(Events.RENAME);
|
||||
|
||||
event.item = selectedFolder;
|
||||
|
||||
window.dispatchEvent(event);
|
||||
};
|
||||
|
||||
const onOpenSharingPanel = () => {
|
||||
setBufferSelection(selectedFolder);
|
||||
setIsFolderActions(true);
|
||||
return setSharingPanelVisible(true);
|
||||
};
|
||||
|
||||
const onClickShare = () => {
|
||||
setShareFolderDialogVisible(true);
|
||||
};
|
||||
|
||||
const onDeleteAction = () => {
|
||||
setIsFolderActions(true);
|
||||
|
||||
if (confirmDelete || isThirdPartySelection) {
|
||||
getFolderInfo(currentFolderId).then((data) => {
|
||||
setBufferSelection(data);
|
||||
setDeleteDialogVisible(true);
|
||||
});
|
||||
} else {
|
||||
const translations = {
|
||||
deleteOperation: t("Translations:DeleteOperation"),
|
||||
deleteFromTrash: t("Translations:DeleteFromTrash"),
|
||||
deleteSelectedElem: t("Translations:DeleteSelectedElem"),
|
||||
FolderRemoved: t("Files:FolderRemoved"),
|
||||
};
|
||||
|
||||
deleteAction(translations, [selectedFolder], true).catch((err) =>
|
||||
toastr.error(err),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const onEmptyTrashAction = () => {
|
||||
const isExistActiveItems = [...activeFiles, ...activeFolders].length > 0;
|
||||
|
||||
if (isExistActiveItems || emptyTrashInProgress) return;
|
||||
|
||||
setEmptyTrashDialogVisible(true);
|
||||
};
|
||||
|
||||
const onRestoreAllAction = () => {
|
||||
setRestoreAllPanelVisible;
|
||||
const isExistActiveItems = [...activeFiles, ...activeFolders].length > 0;
|
||||
|
||||
if (isExistActiveItems) return;
|
||||
|
||||
setRestoreAllPanelVisible(true);
|
||||
};
|
||||
|
||||
const onRestoreAllArchiveAction = () => {
|
||||
const isExistActiveItems = [...activeFiles, ...activeFolders].length > 0;
|
||||
|
||||
if (isExistActiveItems) return;
|
||||
|
||||
if (isGracePeriod) {
|
||||
setInviteUsersWarningDialogVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
setRestoreAllArchive(true);
|
||||
setRestoreRoomDialogVisible(true);
|
||||
};
|
||||
|
||||
const onShowInfo = () => {
|
||||
const { setIsInfoPanelVisible } = props;
|
||||
setIsInfoPanelVisible(true);
|
||||
};
|
||||
|
||||
const onToggleInfoPanel = () => {
|
||||
setIsInfoPanelVisible(!isInfoPanelVisible);
|
||||
};
|
||||
|
||||
const onCopyLinkAction = () => {
|
||||
onCopyLink && onCopyLink({ ...selectedFolder, isFolder: true }, t);
|
||||
};
|
||||
|
||||
const onDownloadAll = () => {
|
||||
onDownloadAction();
|
||||
};
|
||||
|
||||
const onShareRoom = () => {
|
||||
copy(window.location.href);
|
||||
toastr.success(t("Translations:LinkCopySuccess"));
|
||||
};
|
||||
|
||||
const onDeleteRoomInArchive = () => {
|
||||
setSelection([selectedFolder]);
|
||||
deleteRooms(t);
|
||||
};
|
||||
|
||||
const getContextOptionsFolder = () => {
|
||||
const {
|
||||
t,
|
||||
isRoom,
|
||||
isRecycleBinFolder,
|
||||
isArchiveFolder,
|
||||
isPersonalRoom,
|
||||
|
||||
selectedFolder,
|
||||
|
||||
onClickEditRoom,
|
||||
onClickInviteUsers,
|
||||
onShowInfoPanel,
|
||||
onClickReconnectStorage,
|
||||
|
||||
canRestoreAll,
|
||||
canDeleteAll,
|
||||
|
||||
security,
|
||||
haveLinksRight,
|
||||
isPublicRoom,
|
||||
isFrame,
|
||||
} = props;
|
||||
|
||||
const isArchive = selectedFolder.rootFolderType === FolderType.Archive;
|
||||
|
||||
if (isPublicRoom) {
|
||||
return [
|
||||
{
|
||||
key: "public-room_share",
|
||||
label: t("Files:CopyLink"),
|
||||
icon: TabletLinkReactSvgUrl,
|
||||
onClick: onShareRoom,
|
||||
disabled: isFrame,
|
||||
},
|
||||
{
|
||||
key: "public-room_edit",
|
||||
label: t("Common:Download"),
|
||||
icon: DownloadReactSvgUrl,
|
||||
onClick: onDownloadAll,
|
||||
disabled: !security?.Download,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
const isDisabled = isRecycleBinFolder || isRoom;
|
||||
|
||||
if (isArchiveFolder) {
|
||||
return [
|
||||
{
|
||||
id: "header_option_empty-archive",
|
||||
key: "empty-archive",
|
||||
label: t("ArchiveAction"),
|
||||
onClick: onEmptyTrashAction,
|
||||
disabled: !canDeleteAll,
|
||||
icon: ClearTrashReactSvgUrl,
|
||||
},
|
||||
{
|
||||
id: "header_option_restore-all",
|
||||
key: "restore-all",
|
||||
label: t("RestoreAll"),
|
||||
onClick: onRestoreAllArchiveAction,
|
||||
disabled: !canRestoreAll,
|
||||
icon: MoveReactSvgUrl,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
if (isInsideGroup) {
|
||||
return getGroupContextOptions(t, currentGroup, false, true);
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
id: "header_option_sharing-settings",
|
||||
key: "sharing-settings",
|
||||
label: t("Common:Share"),
|
||||
onClick: onClickShare,
|
||||
disabled: !selectedFolder.security?.CreateRoomFrom,
|
||||
icon: ShareReactSvgUrl,
|
||||
},
|
||||
{
|
||||
id: "header_option_link-portal-users",
|
||||
key: "link-portal-users",
|
||||
label: t("LinkForPortalUsers", { productName: PRODUCT_NAME }),
|
||||
onClick: createLinkForPortalUsers,
|
||||
disabled: true,
|
||||
icon: InvitationLinkReactSvgUrl,
|
||||
},
|
||||
{
|
||||
id: "header_option_link-for-room-members",
|
||||
key: "link-for-room-members",
|
||||
label: t("Files:CopyLink"),
|
||||
onClick: onCopyLinkAction,
|
||||
disabled:
|
||||
isRecycleBinFolder ||
|
||||
isPersonalRoom ||
|
||||
!security?.CopyLink ||
|
||||
((isPublicRoomType || isCustomRoomType || isFormRoomType) &&
|
||||
haveLinksRight &&
|
||||
!isArchive),
|
||||
icon: InvitationLinkReactSvgUrl,
|
||||
},
|
||||
{
|
||||
id: "header_option_empty-trash",
|
||||
key: "empty-trash",
|
||||
label: t("Files:EmptyRecycleBin"),
|
||||
onClick: onEmptyTrashAction,
|
||||
disabled: !isRecycleBinFolder,
|
||||
icon: ClearTrashReactSvgUrl,
|
||||
},
|
||||
{
|
||||
id: "header_option_restore-all",
|
||||
key: "restore-all",
|
||||
label: t("RestoreAll"),
|
||||
onClick: onRestoreAllAction,
|
||||
disabled: !isRecycleBinFolder,
|
||||
icon: MoveReactSvgUrl,
|
||||
},
|
||||
{
|
||||
id: "header_option_show-info",
|
||||
key: "show-info",
|
||||
label: t("Common:Info"),
|
||||
onClick: onShowInfo,
|
||||
disabled: isDisabled,
|
||||
icon: InfoOutlineReactSvgUrl,
|
||||
},
|
||||
{
|
||||
id: "header_option_reconnect-storage",
|
||||
key: "reconnect-storage",
|
||||
label: t("Common:ReconnectStorage"),
|
||||
icon: ReconnectSvgUrl,
|
||||
onClick: () => onClickReconnectStorage(selectedFolder, t),
|
||||
disabled: !security?.EditRoom || !security?.Reconnect,
|
||||
},
|
||||
{
|
||||
id: "header_option_edit-room",
|
||||
key: "edit-room",
|
||||
label: t("EditRoom"),
|
||||
icon: SettingsReactSvgUrl,
|
||||
onClick: () => onClickEditRoom(selectedFolder),
|
||||
disabled: !isRoom || !security?.EditRoom,
|
||||
},
|
||||
{
|
||||
id: "header_option_copy-external-link",
|
||||
key: "copy-external-link",
|
||||
label: t("Files:CopySharedLink"),
|
||||
icon: CopyToReactSvgUrl,
|
||||
onClick: async () => {
|
||||
if (primaryLink) {
|
||||
copyShareLink(primaryLink.sharedTo.shareLink);
|
||||
toastr.success(t("Translations:LinkCopySuccess"));
|
||||
} else {
|
||||
const link = await getPrimaryLink(currentFolderId);
|
||||
if (link) {
|
||||
copyShareLink(link.sharedTo.shareLink);
|
||||
toastr.success(t("Files:LinkSuccessfullyCreatedAndCopied"));
|
||||
setExternalLink(link);
|
||||
}
|
||||
}
|
||||
},
|
||||
disabled:
|
||||
(!isPublicRoomType && !isCustomRoomType && !isFormRoomType) ||
|
||||
!haveLinksRight ||
|
||||
isArchive,
|
||||
},
|
||||
{
|
||||
id: "header_option_invite-users-to-room",
|
||||
key: "invite-users-to-room",
|
||||
label: t("Common:InviteUsers"),
|
||||
icon: PersonReactSvgUrl,
|
||||
onClick: () =>
|
||||
onClickInviteUsers(selectedFolder.id, selectedFolder.roomType),
|
||||
disabled: !isRoom || !security?.EditAccess,
|
||||
},
|
||||
{
|
||||
id: "header_option_room-info",
|
||||
key: "room-info",
|
||||
label: t("Common:Info"),
|
||||
icon: InfoOutlineReactSvgUrl,
|
||||
onClick: onToggleInfoPanel,
|
||||
disabled: !isRoom,
|
||||
},
|
||||
{
|
||||
id: "header_option_separator-2",
|
||||
key: "separator-2",
|
||||
isSeparator: true,
|
||||
disabled: isRecycleBinFolder,
|
||||
},
|
||||
{
|
||||
id: "header_option_archive-room",
|
||||
key: "archive-room",
|
||||
label: t("MoveToArchive"),
|
||||
icon: RoomArchiveSvgUrl,
|
||||
onClick: onClickArchiveAction,
|
||||
disabled: !isRoom || !security?.Move || isArchive,
|
||||
"data-action": "archive",
|
||||
action: "archive",
|
||||
},
|
||||
{
|
||||
id: "option_create-room",
|
||||
label: t("Files:CreateRoom"),
|
||||
key: "create-room",
|
||||
icon: CatalogRoomsReactSvgUrl,
|
||||
onClick: () => {
|
||||
onClickCreateRoom({ title: selectedFolder.title, isFolder: true });
|
||||
},
|
||||
disabled: !selectedFolder.security?.CreateRoomFrom,
|
||||
},
|
||||
{
|
||||
id: "option_leave-room",
|
||||
key: "leave-room",
|
||||
label: t("LeaveTheRoom"),
|
||||
icon: LeaveRoomSvgUrl,
|
||||
onClick: onLeaveRoom,
|
||||
disabled: isArchive || !inRoom || isPublicRoom,
|
||||
},
|
||||
{
|
||||
id: "header_option_download",
|
||||
key: "download",
|
||||
label: t("Common:Download"),
|
||||
onClick: onDownloadAction,
|
||||
disabled: !security?.Download,
|
||||
icon: DownloadReactSvgUrl,
|
||||
},
|
||||
{
|
||||
id: "header_option_unarchive-room",
|
||||
key: "unarchive-room",
|
||||
label: t("Common:Restore"),
|
||||
onClick: onClickArchiveAction,
|
||||
disabled: !isArchive || !isRoom,
|
||||
icon: MoveReactSvgUrl,
|
||||
},
|
||||
{
|
||||
id: "header_option_move-to",
|
||||
key: "move-to",
|
||||
label: t("Common:MoveTo"),
|
||||
onClick: onMoveAction,
|
||||
disabled: isDisabled || !security?.MoveTo,
|
||||
icon: MoveReactSvgUrl,
|
||||
},
|
||||
{
|
||||
id: "header_option_copy",
|
||||
key: "copy",
|
||||
label: t("Common:Copy"),
|
||||
onClick: onCopyAction,
|
||||
disabled:
|
||||
isDisabled || (isArchive ? !security?.Copy : !security?.CopyTo),
|
||||
return getHeaderOptions(t, selectedFolder);
|
||||
};
|
||||
|
||||
icon: CopyReactSvgUrl,
|
||||
},
|
||||
{
|
||||
id: "header_option_rename",
|
||||
key: "rename",
|
||||
label: t("Common:Rename"),
|
||||
onClick: renameAction,
|
||||
disabled: isDisabled || !security?.Rename,
|
||||
icon: RenameReactSvgUrl,
|
||||
},
|
||||
{
|
||||
id: "header_option_separator-3",
|
||||
key: "separator-3",
|
||||
isSeparator: true,
|
||||
disabled: isDisabled || !security?.Delete,
|
||||
},
|
||||
{
|
||||
id: "header_option_delete",
|
||||
key: "delete",
|
||||
label: t("Common:Delete"),
|
||||
onClick: isArchive ? onDeleteRoomInArchive : onDeleteAction,
|
||||
disabled: isArchive ? !isRoom : isDisabled || !security?.Delete,
|
||||
icon: CatalogTrashReactSvgUrl,
|
||||
},
|
||||
];
|
||||
const onContextOptionsClick = () => {
|
||||
setBufferSelection(selectedFolder);
|
||||
};
|
||||
|
||||
const onSelect = (e) => {
|
||||
@ -1018,6 +557,7 @@ const SectionHeaderContent = (props) => {
|
||||
onNavigationButtonClick={onNavigationButtonClick}
|
||||
tariffBar={<TariffBar />}
|
||||
showNavigationButton={!!showNavigationButton}
|
||||
onContextOptionsClick={onContextOptionsClick}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
@ -1054,24 +594,20 @@ export default inject(
|
||||
({
|
||||
filesStore,
|
||||
peopleStore,
|
||||
dialogsStore,
|
||||
selectedFolderStore,
|
||||
treeFoldersStore,
|
||||
filesActionsStore,
|
||||
filesSettingsStore,
|
||||
clientLoadingStore,
|
||||
publicRoomStore,
|
||||
contextOptionsStore,
|
||||
infoPanelStore,
|
||||
userStore,
|
||||
currentTariffStatusStore,
|
||||
settingsStore,
|
||||
uploadDataStore,
|
||||
indexingStore,
|
||||
}) => {
|
||||
const { startUpload } = uploadDataStore;
|
||||
const isRoomAdmin = userStore.user?.isRoomAdmin;
|
||||
const isCollaborator = userStore.user?.isCollaborator;
|
||||
|
||||
const {
|
||||
setSelected,
|
||||
@ -1079,16 +615,10 @@ export default inject(
|
||||
isHeaderVisible,
|
||||
isHeaderIndeterminate,
|
||||
isHeaderChecked,
|
||||
isThirdPartySelection,
|
||||
cbMenuItems,
|
||||
getCheckboxItemLabel,
|
||||
getCheckboxItemId,
|
||||
isEmptyFilesList,
|
||||
getFolderInfo,
|
||||
setBufferSelection,
|
||||
|
||||
activeFiles,
|
||||
activeFolders,
|
||||
|
||||
roomsForRestore,
|
||||
roomsForDelete,
|
||||
@ -1096,8 +626,7 @@ export default inject(
|
||||
isEmptyPage,
|
||||
|
||||
categoryType,
|
||||
getPrimaryLink,
|
||||
setSelection,
|
||||
setBufferSelection,
|
||||
} = filesStore;
|
||||
|
||||
const {
|
||||
@ -1111,42 +640,15 @@ export default inject(
|
||||
setIsSectionFilterLoading(param);
|
||||
};
|
||||
|
||||
const {
|
||||
setSharingPanelVisible,
|
||||
setMoveToPanelVisible,
|
||||
setCopyPanelVisible,
|
||||
setDeleteDialogVisible,
|
||||
setEmptyTrashDialogVisible,
|
||||
setIsFolderActions,
|
||||
setRestoreAllPanelVisible,
|
||||
setRestoreRoomDialogVisible,
|
||||
setRestoreAllArchive,
|
||||
setInviteUsersWarningDialogVisible,
|
||||
setLeaveRoomDialogVisible,
|
||||
setSelectFileFormRoomDialogVisible,
|
||||
setShareFolderDialogVisible,
|
||||
setReorderDialogVisible,
|
||||
} = dialogsStore;
|
||||
const { isRecycleBinFolder, isRoomsFolder, isArchiveFolder } =
|
||||
treeFoldersStore;
|
||||
|
||||
const {
|
||||
isRecycleBinFolder,
|
||||
isRoomsFolder,
|
||||
isArchiveFolder,
|
||||
isPersonalRoom,
|
||||
isArchiveFolderRoot,
|
||||
} = treeFoldersStore;
|
||||
|
||||
const {
|
||||
deleteAction,
|
||||
downloadAction,
|
||||
getHeaderMenu,
|
||||
isGroupMenuBlocked,
|
||||
moveToRoomsPage,
|
||||
onClickBack,
|
||||
emptyTrashInProgress,
|
||||
moveToPublicRoom,
|
||||
onClickCreateRoom,
|
||||
deleteRooms,
|
||||
reorder,
|
||||
} = filesActionsStore;
|
||||
|
||||
@ -1154,17 +656,12 @@ export default inject(
|
||||
|
||||
const {
|
||||
title,
|
||||
id,
|
||||
roomType,
|
||||
pathParts,
|
||||
navigationPath,
|
||||
security,
|
||||
inRoom,
|
||||
access,
|
||||
canCopyPublicLink,
|
||||
rootFolderType,
|
||||
parentRoomType,
|
||||
isFolder,
|
||||
shared,
|
||||
} = selectedFolderStore;
|
||||
|
||||
@ -1177,7 +674,6 @@ export default inject(
|
||||
} = peopleStore.groupsStore;
|
||||
|
||||
const { theme, frameConfig, isFrame, currentDeviceType } = settingsStore;
|
||||
const { isGracePeriod } = currentTariffStatusStore;
|
||||
|
||||
const isRoom = !!roomType;
|
||||
const isPublicRoomType = roomType === RoomsType.PublicRoom;
|
||||
@ -1185,15 +681,11 @@ export default inject(
|
||||
const isFormRoomType = roomType === RoomsType.FormRoom;
|
||||
|
||||
const {
|
||||
onClickEditRoom,
|
||||
onClickInviteUsers,
|
||||
onShowInfoPanel,
|
||||
onClickArchive,
|
||||
onClickReconnectStorage,
|
||||
onCopyLink,
|
||||
onCreateAndCopySharedLink,
|
||||
getFolderModel,
|
||||
onCreateRoom,
|
||||
getHeaderOptions,
|
||||
onEmptyTrashAction,
|
||||
} = contextOptionsStore;
|
||||
|
||||
const canRestoreAll = isArchiveFolder && roomsForRestore.length > 0;
|
||||
@ -1222,7 +714,7 @@ export default inject(
|
||||
|
||||
const { isIndexEditingMode, setIsIndexEditingMode } = indexingStore;
|
||||
const { setSelected: setAccountsSelected } = selectionStore;
|
||||
const { isPublicRoom, primaryLink, setExternalLink } = publicRoomStore;
|
||||
const { isPublicRoom } = publicRoomStore;
|
||||
|
||||
let folderPath = navigationPath;
|
||||
|
||||
@ -1235,10 +727,6 @@ export default inject(
|
||||
? pathParts?.length === 1 || pathParts?.length === 2
|
||||
: pathParts?.length === 1;
|
||||
|
||||
const haveLinksRight =
|
||||
access === ShareAccessRights.RoomManager ||
|
||||
access === ShareAccessRights.None;
|
||||
|
||||
const isArchive = rootFolderType === FolderType.Archive;
|
||||
|
||||
const sharedItem = navigationPath.find((r) => r.shared);
|
||||
@ -1254,17 +742,13 @@ export default inject(
|
||||
(sharedItem && sharedItem.canCopyPublicLink);
|
||||
|
||||
return {
|
||||
isGracePeriod,
|
||||
setInviteUsersWarningDialogVisible,
|
||||
showText: settingsStore.showText,
|
||||
isDesktop: settingsStore.isDesktopClient,
|
||||
showHeaderLoader,
|
||||
isLoading,
|
||||
isRootFolder: isPublicRoom && !folderPath?.length ? true : isRoot,
|
||||
isPersonalRoom,
|
||||
title,
|
||||
isRoom,
|
||||
currentFolderId: id,
|
||||
|
||||
navigationPath: folderPath,
|
||||
|
||||
@ -1275,71 +759,36 @@ export default inject(
|
||||
setIsIndexEditingMode,
|
||||
isHeaderIndeterminate,
|
||||
isHeaderChecked,
|
||||
isThirdPartySelection,
|
||||
isTabletView: settingsStore.isTabletView,
|
||||
confirmDelete: filesSettingsStore.confirmDelete,
|
||||
cbMenuItems,
|
||||
setSelectedNode: treeFoldersStore.setSelectedNode,
|
||||
getFolderInfo,
|
||||
|
||||
setSelected,
|
||||
security,
|
||||
canCopyPublicLink,
|
||||
|
||||
setSharingPanelVisible,
|
||||
setMoveToPanelVisible,
|
||||
setCopyPanelVisible,
|
||||
setReorderDialogVisible,
|
||||
setBufferSelection,
|
||||
setIsFolderActions,
|
||||
deleteAction,
|
||||
setDeleteDialogVisible,
|
||||
downloadAction,
|
||||
getHeaderMenu,
|
||||
getCheckboxItemLabel,
|
||||
getCheckboxItemId,
|
||||
|
||||
isRecycleBinFolder,
|
||||
setEmptyTrashDialogVisible,
|
||||
isEmptyFilesList,
|
||||
isEmptyArchive,
|
||||
isArchiveFolder,
|
||||
|
||||
setIsLoading,
|
||||
|
||||
activeFiles,
|
||||
activeFolders,
|
||||
|
||||
isRoomsFolder,
|
||||
|
||||
setRestoreAllPanelVisible,
|
||||
|
||||
setRestoreRoomDialogVisible,
|
||||
setRestoreAllArchive,
|
||||
|
||||
selectedFolder,
|
||||
|
||||
onClickEditRoom,
|
||||
onClickCreateRoom,
|
||||
onClickInviteUsers,
|
||||
onShowInfoPanel,
|
||||
onClickArchive,
|
||||
onCopyLink,
|
||||
|
||||
isEmptyArchive,
|
||||
canRestoreAll,
|
||||
canDeleteAll,
|
||||
isGroupMenuBlocked,
|
||||
|
||||
moveToRoomsPage,
|
||||
onClickBack,
|
||||
isPublicRoomType,
|
||||
isCustomRoomType,
|
||||
isFormRoomType,
|
||||
isPublicRoom,
|
||||
primaryLink,
|
||||
getPrimaryLink,
|
||||
setExternalLink,
|
||||
|
||||
moveToPublicRoom,
|
||||
|
||||
@ -1356,32 +805,25 @@ export default inject(
|
||||
getAccountsCheckboxItemLabel,
|
||||
setAccountsSelected,
|
||||
isRoomAdmin,
|
||||
isCollaborator,
|
||||
isEmptyPage,
|
||||
emptyTrashInProgress,
|
||||
categoryType,
|
||||
theme,
|
||||
isFrame,
|
||||
showTitle: frameConfig?.showTitle,
|
||||
hideInfoPanel: isFrame && !frameConfig?.infoPanelVisible,
|
||||
currentDeviceType,
|
||||
setLeaveRoomDialogVisible,
|
||||
inRoom,
|
||||
insideGroupTempTitle,
|
||||
currentGroup,
|
||||
getGroupContextOptions,
|
||||
onCreateAndCopySharedLink,
|
||||
showNavigationButton,
|
||||
haveLinksRight,
|
||||
setSelectFileFormRoomDialogVisible,
|
||||
deleteRooms,
|
||||
setSelection,
|
||||
setShareFolderDialogVisible,
|
||||
startUpload,
|
||||
reorder,
|
||||
onClickReconnectStorage,
|
||||
getFolderModel,
|
||||
onCreateRoom,
|
||||
onEmptyTrashAction,
|
||||
getHeaderOptions,
|
||||
setBufferSelection,
|
||||
};
|
||||
},
|
||||
)(
|
||||
|
@ -57,7 +57,6 @@ import MuteReactSvgUrl from "PUBLIC_DIR/images/icons/16/mute.react.svg?url";
|
||||
import ShareReactSvgUrl from "PUBLIC_DIR/images/share.react.svg?url";
|
||||
import InvitationLinkReactSvgUrl from "PUBLIC_DIR/images/invitation.link.react.svg?url";
|
||||
import EditIndexReactSvgUrl from "PUBLIC_DIR/images/edit.index.react.svg?url";
|
||||
import CopyToReactSvgUrl from "PUBLIC_DIR/images/copyTo.react.svg?url";
|
||||
import TabletLinkReactSvgUrl from "PUBLIC_DIR/images/tablet-link.react.svg?url";
|
||||
import MailReactSvgUrl from "PUBLIC_DIR/images/mail.react.svg?url";
|
||||
import RoomArchiveSvgUrl from "PUBLIC_DIR/images/room.archive.svg?url";
|
||||
@ -71,7 +70,6 @@ import PersonDefaultReactSvgUrl from "PUBLIC_DIR/images/person.default.react.svg
|
||||
import InviteAgainReactSvgUrl from "PUBLIC_DIR/images/invite.again.react.svg?url";
|
||||
import PersonUserReactSvgUrl from "PUBLIC_DIR/images/person.user.react.svg?url";
|
||||
import GroupReactSvgUrl from "PUBLIC_DIR/images/group.react.svg?url";
|
||||
import FolderLockedReactSvgUrl from "PUBLIC_DIR/images/folder.locked.react.svg?url";
|
||||
import ActionsDocumentsReactSvgUrl from "PUBLIC_DIR/images/actions.documents.react.svg?url";
|
||||
import SpreadsheetReactSvgUrl from "PUBLIC_DIR/images/spreadsheet.react.svg?url";
|
||||
import ActionsPresentationReactSvgUrl from "PUBLIC_DIR/images/actions.presentation.react.svg?url";
|
||||
@ -82,17 +80,18 @@ import CatalogFolderReactSvgUrl from "PUBLIC_DIR/images/catalog.folder.react.svg
|
||||
import ActionsUploadReactSvgUrl from "PUBLIC_DIR/images/actions.upload.react.svg?url";
|
||||
import PluginMoreReactSvgUrl from "PUBLIC_DIR/images/plugin.more.react.svg?url";
|
||||
import CodeReactSvgUrl from "PUBLIC_DIR/images/code.react.svg?url";
|
||||
import ClearTrashReactSvgUrl from "PUBLIC_DIR/images/clear.trash.react.svg?url";
|
||||
|
||||
import { getCategoryUrl } from "@docspace/client/src/helpers/utils";
|
||||
|
||||
import { makeAutoObservable } from "mobx";
|
||||
import copy from "copy-to-clipboard";
|
||||
import saveAs from "file-saver";
|
||||
import { isMobile, isIOS, isTablet } from "react-device-detect";
|
||||
import { isMobile, isTablet } from "react-device-detect";
|
||||
import config from "PACKAGE_FILE";
|
||||
import { toastr } from "@docspace/shared/components/toast";
|
||||
import { combineUrl } from "@docspace/shared/utils/combineUrl";
|
||||
import { isDesktop } from "@docspace/shared/utils";
|
||||
import { isDesktop, trimSeparator } from "@docspace/shared/utils";
|
||||
import { getDefaultAccessUser } from "@docspace/shared/utils/getDefaultAccessUser";
|
||||
import { copyShareLink } from "@docspace/shared/utils/copy";
|
||||
|
||||
@ -300,24 +299,37 @@ class ContextOptionsStore {
|
||||
this.dialogsStore.setChangeOwnerPanelVisible(true);
|
||||
};
|
||||
|
||||
onMoveAction = () => {
|
||||
onMoveAction = (item) => {
|
||||
const { setIsMobileHidden } = this.infoPanelStore;
|
||||
const { id, isFolder } = this.selectedFolderStore;
|
||||
|
||||
setIsMobileHidden(true);
|
||||
|
||||
const isFolderActions = id === item?.id && isFolder === item?.isFolder;
|
||||
if (isFolderActions) {
|
||||
this.dialogsStore.setIsFolderActions(true);
|
||||
}
|
||||
|
||||
this.dialogsStore.setMoveToPanelVisible(true);
|
||||
};
|
||||
|
||||
onRestoreAction = () => {
|
||||
const { setIsMobileHidden } = this.infoPanelStore;
|
||||
setIsMobileHidden(true);
|
||||
console.log("Click");
|
||||
this.dialogsStore.setRestorePanelVisible(true);
|
||||
};
|
||||
|
||||
onCopyAction = () => {
|
||||
onCopyAction = (item) => {
|
||||
const { setIsMobileHidden } = this.infoPanelStore;
|
||||
const { id, isFolder } = this.selectedFolderStore;
|
||||
|
||||
setIsMobileHidden(true);
|
||||
|
||||
const isFolderActions = id === item?.id && isFolder === item?.isFolder;
|
||||
if (isFolderActions) {
|
||||
this.dialogsStore.setIsFolderActions(true);
|
||||
}
|
||||
|
||||
this.dialogsStore.setCopyPanelVisible(true);
|
||||
};
|
||||
|
||||
@ -453,9 +465,11 @@ class ContextOptionsStore {
|
||||
this.selectedFolderStore;
|
||||
const { setLinkParams, setEmbeddingPanelData } = this.dialogsStore;
|
||||
|
||||
const sharedItem = shared
|
||||
? getSelectedFolder()
|
||||
: navigationPath.find((r) => r.shared);
|
||||
const sharedItem = item.isRoom
|
||||
? item
|
||||
: shared
|
||||
? getSelectedFolder()
|
||||
: navigationPath.find((r) => r.shared);
|
||||
|
||||
if (!sharedItem) return;
|
||||
|
||||
@ -468,7 +482,7 @@ class ContextOptionsStore {
|
||||
isFormRoom,
|
||||
});
|
||||
|
||||
setEmbeddingPanelData({ visible: true, fileId: item.id });
|
||||
setEmbeddingPanelData({ visible: true, item });
|
||||
};
|
||||
|
||||
onCreateAndCopySharedLink = async (item, t) => {
|
||||
@ -507,12 +521,12 @@ class ContextOptionsStore {
|
||||
this.filesStore.openDocEditor(id, preview);
|
||||
};
|
||||
|
||||
isPwa = () => {
|
||||
return ["fullscreen", "standalone", "minimal-ui"].some(
|
||||
(displayMode) =>
|
||||
window.matchMedia("(display-mode: " + displayMode + ")").matches,
|
||||
);
|
||||
};
|
||||
// isPwa = () => {
|
||||
// return ["fullscreen", "standalone", "minimal-ui"].some(
|
||||
// (displayMode) =>
|
||||
// window.matchMedia("(display-mode: " + displayMode + ")").matches,
|
||||
// );
|
||||
// };
|
||||
|
||||
onClickDownload = (item, t) => {
|
||||
const { fileExst, contentLength, viewUrl } = item;
|
||||
@ -521,23 +535,6 @@ class ContextOptionsStore {
|
||||
const { openUrl } = this.settingsStore;
|
||||
const { downloadAction } = this.filesActionsStore;
|
||||
|
||||
if (isIOS && this.isPwa()) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", viewUrl);
|
||||
xhr.responseType = "blob";
|
||||
|
||||
xhr.onload = () => {
|
||||
saveAs(xhr.response, item.title);
|
||||
};
|
||||
|
||||
xhr.onerror = () => {
|
||||
console.error("download failed", viewUrl);
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
return;
|
||||
}
|
||||
|
||||
isFile
|
||||
? openUrl(viewUrl, UrlActionType.Download)
|
||||
: downloadAction(t("Translations:ArchivingData"), item).catch((err) =>
|
||||
@ -1080,7 +1077,142 @@ class ContextOptionsStore {
|
||||
return { pinOptions, muteOptions };
|
||||
};
|
||||
|
||||
getFilesContextOptions = (item, t, isInfoPanel) => {
|
||||
onEmptyTrashAction = () => {
|
||||
const { activeFiles, activeFolders } = this.filesStore;
|
||||
const isExistActiveItems = [...activeFiles, ...activeFolders].length > 0;
|
||||
|
||||
if (isExistActiveItems || this.filesActionsStore.emptyTrashInProgress)
|
||||
return;
|
||||
|
||||
this.dialogsStore.setEmptyTrashDialogVisible(true);
|
||||
};
|
||||
|
||||
onRestoreAllAction = () => {
|
||||
const { activeFiles, activeFolders } = this.filesStore;
|
||||
const isExistActiveItems = [...activeFiles, ...activeFolders].length > 0;
|
||||
|
||||
if (isExistActiveItems) return;
|
||||
|
||||
this.dialogsStore.setRestoreAllPanelVisible(true);
|
||||
};
|
||||
|
||||
onRestoreAllArchiveAction = () => {
|
||||
const { activeFiles, activeFolders } = this.filesStore;
|
||||
const {
|
||||
setInviteUsersWarningDialogVisible,
|
||||
setRestoreAllArchive,
|
||||
setRestoreRoomDialogVisible,
|
||||
} = this.dialogsStore;
|
||||
|
||||
const isExistActiveItems = [...activeFiles, ...activeFolders].length > 0;
|
||||
|
||||
if (isExistActiveItems) return;
|
||||
|
||||
if (this.currentTariffStatusStore.isGracePeriod) {
|
||||
setInviteUsersWarningDialogVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
setRestoreAllArchive(true);
|
||||
setRestoreRoomDialogVisible(true);
|
||||
};
|
||||
|
||||
getHeaderOptions = (t, item) => {
|
||||
const { isRecycleBinFolder, isArchiveFolder } = this.treeFoldersStore;
|
||||
const { roomsForDelete, roomsForRestore } = this.filesStore;
|
||||
|
||||
const canRestoreAll = roomsForRestore.length > 0;
|
||||
const canDeleteAll = roomsForDelete.length > 0;
|
||||
|
||||
if (this.publicRoomStore.isPublicRoom) {
|
||||
return [
|
||||
{
|
||||
key: "public-room_share",
|
||||
label: t("Files:CopyLink"),
|
||||
icon: TabletLinkReactSvgUrl,
|
||||
onClick: () => {
|
||||
copy(window.location.href);
|
||||
toastr.success(t("Translations:LinkCopySuccess"));
|
||||
},
|
||||
disabled: this.settingsStore.isFrame,
|
||||
},
|
||||
{
|
||||
key: "public-room_edit",
|
||||
label: t("Common:Download"),
|
||||
icon: DownloadReactSvgUrl,
|
||||
onClick: () => {
|
||||
onClickDownload(item, t);
|
||||
},
|
||||
disabled: !item.security?.Download,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
if (isRecycleBinFolder) {
|
||||
return [
|
||||
{
|
||||
id: "header_option_empty-trash",
|
||||
key: "empty-trash",
|
||||
label: t("Files:EmptyRecycleBin"),
|
||||
onClick: this.onEmptyTrashAction,
|
||||
icon: ClearTrashReactSvgUrl,
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
id: "header_option_restore-all",
|
||||
key: "restore-all",
|
||||
label: t("RestoreAll"),
|
||||
onClick: this.onRestoreAllAction,
|
||||
icon: MoveReactSvgUrl,
|
||||
disabled: false,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
if (isArchiveFolder) {
|
||||
return [
|
||||
{
|
||||
id: "header_option_empty-archive",
|
||||
key: "empty-archive",
|
||||
label: t("ArchiveAction"),
|
||||
onClick: this.onEmptyTrashAction,
|
||||
disabled: !canDeleteAll,
|
||||
icon: ClearTrashReactSvgUrl,
|
||||
},
|
||||
{
|
||||
id: "header_option_restore-all",
|
||||
key: "restore-all",
|
||||
label: t("RestoreAll"),
|
||||
onClick: this.onRestoreAllArchiveAction,
|
||||
disabled: !canRestoreAll,
|
||||
icon: MoveReactSvgUrl,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
return this.getFilesContextOptions(item, t, false, true);
|
||||
};
|
||||
|
||||
getFilesContextOptions = (item, t, isInfoPanel, isHeader) => {
|
||||
const optionsToRemove = isInfoPanel
|
||||
? ["select", "room-info", "show-info"]
|
||||
: isHeader
|
||||
? ["select"]
|
||||
: [];
|
||||
|
||||
if (!item.contextOptions) {
|
||||
const contextOptions = this.filesStore.getFilesContextOptions(
|
||||
item,
|
||||
optionsToRemove,
|
||||
);
|
||||
item = { ...item, contextOptions };
|
||||
} else {
|
||||
item.contextOptions = this.filesStore.removeOptions(
|
||||
item.contextOptions,
|
||||
optionsToRemove,
|
||||
);
|
||||
}
|
||||
|
||||
const { contextOptions, isEditing } = item;
|
||||
|
||||
const isRootThirdPartyFolder =
|
||||
@ -1205,7 +1337,7 @@ class ContextOptionsStore {
|
||||
icon: MoveReactSvgUrl,
|
||||
onClick: isEditing
|
||||
? () => this.onShowEditingToast(t)
|
||||
: this.onMoveAction,
|
||||
: () => this.onMoveAction(item),
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
@ -1213,7 +1345,7 @@ class ContextOptionsStore {
|
||||
key: "copy-to",
|
||||
label: t("Common:Copy"),
|
||||
icon: CopyReactSvgUrl,
|
||||
onClick: this.onCopyAction,
|
||||
onClick: () => this.onCopyAction(item),
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
@ -1235,7 +1367,7 @@ class ContextOptionsStore {
|
||||
icon: MoveReactSvgUrl,
|
||||
onClick: isEditing
|
||||
? () => this.onShowEditingToast(t)
|
||||
: this.onMoveAction,
|
||||
: () => this.onMoveAction(item),
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
@ -1243,7 +1375,7 @@ class ContextOptionsStore {
|
||||
key: "copy-to",
|
||||
label: t("Common:Copy"),
|
||||
icon: CopyReactSvgUrl,
|
||||
onClick: this.onCopyAction,
|
||||
onClick: () => this.onCopyAction(item),
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
@ -1388,7 +1520,7 @@ class ContextOptionsStore {
|
||||
label: t("Common:ReconnectStorage"),
|
||||
icon: ReconnectSvgUrl,
|
||||
onClick: () => this.onClickReconnectStorage(item, t),
|
||||
disabled: !item.security?.Reconnect,
|
||||
disabled: !item.security?.Reconnect || !item.security?.EditRoom,
|
||||
},
|
||||
{
|
||||
id: "option_edit-room",
|
||||
@ -1444,7 +1576,7 @@ class ContextOptionsStore {
|
||||
disabled:
|
||||
(isPublicRoomType && item.canCopyPublicLink && !isArchive) ||
|
||||
this.publicRoomStore.isPublicRoom ||
|
||||
!item.security.CopyLink,
|
||||
!item.security?.CopyLink,
|
||||
},
|
||||
{
|
||||
id: "option_copy-external-link",
|
||||
@ -1710,7 +1842,7 @@ class ContextOptionsStore {
|
||||
!(isCollaborator && option.key === "create-room"),
|
||||
);
|
||||
|
||||
return newOptions;
|
||||
return trimSeparator(newOptions);
|
||||
};
|
||||
|
||||
getGroupContextOptions = (t) => {
|
||||
|
@ -104,7 +104,7 @@ class DialogsStore {
|
||||
createRoomConfirmDialogVisible = false;
|
||||
changeUserTypeDialogVisible = false;
|
||||
editLinkPanelIsVisible = false;
|
||||
embeddingPanelData = { visible: false, fileId: null };
|
||||
embeddingPanelData = { visible: false, item: null };
|
||||
submitToGalleryDialogVisible = false;
|
||||
linkParams = null;
|
||||
leaveRoomDialogVisible = false;
|
||||
|
@ -666,9 +666,12 @@ class FilesActionStore {
|
||||
}
|
||||
};
|
||||
|
||||
downloadAction = (label, item, folderId) => {
|
||||
downloadAction = (label, item) => {
|
||||
const { bufferSelection } = this.filesStore;
|
||||
const { openUrl } = this.settingsStore;
|
||||
const { id, isFolder } = this.selectedFolderStore;
|
||||
|
||||
const downloadAsArchive = id === item?.id && isFolder === item?.isFolder;
|
||||
|
||||
const selection = item
|
||||
? [item]
|
||||
@ -684,7 +687,7 @@ class FilesActionStore {
|
||||
let folderIds = [];
|
||||
const items = [];
|
||||
|
||||
if (selection.length === 1 && selection[0].fileExst && !folderId) {
|
||||
if (selection.length === 1 && selection[0].fileExst && !downloadAsArchive) {
|
||||
openUrl(selection[0].viewUrl, UrlActionType.Download);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
@ -1612,6 +1612,7 @@ class FilesStore {
|
||||
folders: data.folders,
|
||||
...data.current,
|
||||
inRoom: !!data.current.inRoom,
|
||||
isRoom: !!data.current.roomType,
|
||||
pathParts: data.pathParts,
|
||||
navigationPath,
|
||||
...{ new: data.new },
|
||||
@ -1995,7 +1996,7 @@ class FilesStore {
|
||||
return newOptions.filter((o) => o);
|
||||
};
|
||||
|
||||
getFilesContextOptions = (item, fromInfoPanel) => {
|
||||
getFilesContextOptions = (item, optionsToRemove = []) => {
|
||||
const isFile = !!item.fileExst || item.contentLength;
|
||||
const isRoom = !!item.roomType;
|
||||
const isFavorite =
|
||||
@ -2038,6 +2039,7 @@ class FilesStore {
|
||||
const canCopy = item.security?.Copy;
|
||||
const canDuplicate = item.security?.Duplicate;
|
||||
const canDownload = item.security?.Download;
|
||||
const canEmbed = item.security?.Embed;
|
||||
|
||||
if (isFile) {
|
||||
const shouldFillForm = item.viewAccessibility.WebRestrictedEditing;
|
||||
@ -2108,6 +2110,10 @@ class FilesStore {
|
||||
"copy-general-link",
|
||||
];
|
||||
|
||||
if (optionsToRemove.length) {
|
||||
fileOptions = this.removeOptions(fileOptions, optionsToRemove);
|
||||
}
|
||||
|
||||
if (!canDownload) {
|
||||
fileOptions = this.removeOptions(fileOptions, ["download"]);
|
||||
}
|
||||
@ -2203,10 +2209,7 @@ class FilesStore {
|
||||
}
|
||||
|
||||
if (!canViewFile || isRecycleBinFolder) {
|
||||
fileOptions = this.removeOptions(fileOptions, [
|
||||
"preview",
|
||||
"embedding-settings",
|
||||
]);
|
||||
fileOptions = this.removeOptions(fileOptions, ["preview"]);
|
||||
}
|
||||
|
||||
if (!canOpenPlayer || isRecycleBinFolder) {
|
||||
@ -2338,7 +2341,7 @@ class FilesStore {
|
||||
]);
|
||||
}
|
||||
|
||||
if (this.publicRoomStore.isPublicRoom) {
|
||||
if (this.publicRoomStore.isPublicRoom || !canEmbed) {
|
||||
fileOptions = this.removeOptions(fileOptions, ["embedding-settings"]);
|
||||
}
|
||||
|
||||
@ -2385,6 +2388,7 @@ class FilesStore {
|
||||
"edit-room",
|
||||
"invite-users-to-room",
|
||||
"external-link",
|
||||
"embedding-settings",
|
||||
"room-info",
|
||||
"pin-room",
|
||||
"unpin-room",
|
||||
@ -2398,6 +2402,10 @@ class FilesStore {
|
||||
"delete",
|
||||
];
|
||||
|
||||
if (optionsToRemove.length) {
|
||||
roomOptions = this.removeOptions(roomOptions, optionsToRemove);
|
||||
}
|
||||
|
||||
if (!canEditRoom) {
|
||||
roomOptions = this.removeOptions(roomOptions, [
|
||||
"edit-room",
|
||||
@ -2453,6 +2461,10 @@ class FilesStore {
|
||||
: (roomOptions = this.removeOptions(roomOptions, ["unmute-room"]));
|
||||
}
|
||||
|
||||
if (this.publicRoomStore.isPublicRoom || !canEmbed) {
|
||||
roomOptions = this.removeOptions(roomOptions, ["embedding-settings"]);
|
||||
}
|
||||
|
||||
if (!canViewRoomInfo) {
|
||||
roomOptions = this.removeOptions(roomOptions, ["room-info"]);
|
||||
}
|
||||
@ -2476,10 +2488,6 @@ class FilesStore {
|
||||
}
|
||||
}
|
||||
|
||||
// if (fromInfoPanel) {
|
||||
// roomOptions = this.removeOptions(roomOptions, ["external-link"]);
|
||||
// }
|
||||
|
||||
roomOptions = this.removeSeparator(roomOptions);
|
||||
|
||||
return roomOptions;
|
||||
@ -2510,6 +2518,10 @@ class FilesStore {
|
||||
"delete",
|
||||
];
|
||||
|
||||
if (optionsToRemove.length) {
|
||||
folderOptions = this.removeOptions(folderOptions, optionsToRemove);
|
||||
}
|
||||
|
||||
if (!canDownload) {
|
||||
folderOptions = this.removeOptions(folderOptions, ["download"]);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@docspace/doceditor",
|
||||
"version": "2.5.1",
|
||||
"version": "2.6.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "node ./scripts/buildTranslations.js && next build",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@docspace/login",
|
||||
"version": "2.5.0",
|
||||
"version": "2.6.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "node ./scripts/buildTranslations.js && next build",
|
||||
|
@ -43,12 +43,6 @@ const StyledSimpleNav = styled.div`
|
||||
justify-content: center;
|
||||
background-color: ${(props) => props.theme?.login?.navBackground};
|
||||
|
||||
svg {
|
||||
path:last-child {
|
||||
fill: ${(props) => props.theme.client?.home?.logoColor};
|
||||
}
|
||||
}
|
||||
|
||||
@media ${mobile} {
|
||||
display: flex;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@docspace/management",
|
||||
"version": "2.5.1",
|
||||
"version": "2.6.0",
|
||||
"private": true,
|
||||
"homepage": "/management",
|
||||
"scripts": {
|
||||
|
@ -43,10 +43,12 @@ const StyledIconTheme = styled(StyledIcon)<
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
svg {
|
||||
path {
|
||||
fill: ${(props) => props.$currentColorScheme?.main?.accent};
|
||||
@media (hover: hover) {
|
||||
&:hover {
|
||||
svg {
|
||||
path {
|
||||
fill: ${(props) => props.$currentColorScheme?.main?.accent};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,12 +48,15 @@ const StyledOuter = styled.div<IconButtonProps>`
|
||||
stroke: ${props.color || props.theme.iconButton.color};
|
||||
}
|
||||
}
|
||||
&:hover {
|
||||
svg {
|
||||
path {
|
||||
stroke: ${props.isDisabled
|
||||
? props.theme.iconButton.color
|
||||
: props.color || props.theme.iconButton.hoverColor};
|
||||
|
||||
@media (hover: hover) {
|
||||
&:hover {
|
||||
svg {
|
||||
path {
|
||||
stroke: ${props.isDisabled
|
||||
? props.theme.iconButton.color
|
||||
: props.color || props.theme.iconButton.hoverColor};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -72,12 +75,15 @@ const StyledOuter = styled.div<IconButtonProps>`
|
||||
fill: ${props.color || props.theme.iconButton.color};
|
||||
}
|
||||
}
|
||||
&:hover {
|
||||
svg {
|
||||
path {
|
||||
fill: ${props.isDisabled
|
||||
? props.theme.iconButton.color
|
||||
: props.color || props.theme.iconButton.hoverColor};
|
||||
|
||||
@media (hover: hover) {
|
||||
&:hover {
|
||||
svg {
|
||||
path {
|
||||
fill: ${props.isDisabled
|
||||
? props.theme.iconButton.color
|
||||
: props.color || props.theme.iconButton.hoverColor};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,14 +49,13 @@ const PreviewTile = ({
|
||||
</div>
|
||||
<div className="tile-tags">
|
||||
{tags.length ? (
|
||||
<Tags columnCount={2} tags={tags} onSelectTag={() => {}} />
|
||||
<Tags columnCount={2} tags={tags} />
|
||||
) : (
|
||||
<Tag
|
||||
className="type_tag"
|
||||
tag="script"
|
||||
label={defaultTagLabel}
|
||||
isDefault
|
||||
onClick={() => {}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
@ -82,6 +82,7 @@ const Navigation = ({
|
||||
onNavigationButtonClick,
|
||||
tariffBar,
|
||||
showNavigationButton,
|
||||
onContextOptionsClick,
|
||||
...rest
|
||||
}: INavigationProps) => {
|
||||
const [isOpen, setIsOpen] = React.useState(false);
|
||||
@ -291,6 +292,7 @@ const Navigation = ({
|
||||
tariffBar={tariffBar}
|
||||
title={title}
|
||||
isEmptyPage={isEmptyPage}
|
||||
onContextOptionsClick={onContextOptionsClick}
|
||||
/>
|
||||
</StyledContainer>
|
||||
{isDesktop && !hideInfoPanel && (
|
||||
|
@ -50,6 +50,7 @@ export interface IContextButtonProps {
|
||||
id: string;
|
||||
title?: string;
|
||||
onCloseDropBox?: () => void;
|
||||
onContextOptionsClick?: () => void;
|
||||
}
|
||||
|
||||
export interface IPlusButtonProps {
|
||||
@ -95,6 +96,7 @@ export interface IControlButtonProps {
|
||||
title?: string;
|
||||
isEmptyPage?: boolean;
|
||||
onCloseDropBox?: () => void;
|
||||
onContextOptionsClick?: () => void;
|
||||
}
|
||||
|
||||
export interface ITextProps {
|
||||
@ -201,4 +203,5 @@ export interface INavigationProps {
|
||||
onNavigationButtonClick?: () => void;
|
||||
tariffBar: React.ReactElement;
|
||||
showNavigationButton: boolean;
|
||||
onContextOptionsClick?: () => void;
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ const ContextButton = ({
|
||||
isMobile,
|
||||
id,
|
||||
onCloseDropBox,
|
||||
onContextOptionsClick,
|
||||
...rest
|
||||
}: IContextButtonProps) => {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
@ -58,6 +59,7 @@ const ContextButton = ({
|
||||
};
|
||||
|
||||
const onClick = (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
onContextOptionsClick?.();
|
||||
if (withMenu) toggle(e, !isOpen);
|
||||
};
|
||||
|
||||
|
@ -63,6 +63,7 @@ const ControlButtons = ({
|
||||
title,
|
||||
isEmptyPage,
|
||||
onCloseDropBox,
|
||||
onContextOptionsClick,
|
||||
}: IControlButtonProps) => {
|
||||
const toggleInfoPanelAction = () => {
|
||||
toggleInfoPanel?.();
|
||||
@ -125,6 +126,7 @@ const ControlButtons = ({
|
||||
isTrashFolder={isTrashFolder}
|
||||
isMobile={isMobile || false}
|
||||
onCloseDropBox={onCloseDropBox}
|
||||
onContextOptionsClick={onContextOptionsClick}
|
||||
/>
|
||||
|
||||
{!isDesktop && (
|
||||
@ -180,6 +182,7 @@ const ControlButtons = ({
|
||||
isTrashFolder={isTrashFolder}
|
||||
isMobile={isMobile || false}
|
||||
onCloseDropBox={onCloseDropBox}
|
||||
onContextOptionsClick={onContextOptionsClick}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
@ -53,5 +53,5 @@ export interface TagsProps {
|
||||
/** Accepts css style */
|
||||
style?: React.CSSProperties;
|
||||
/** Accepts the function that is called when the tag is selected */
|
||||
onSelectTag: (tag?: object) => void;
|
||||
onSelectTag?: (tag?: object) => void;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@docspace/shared",
|
||||
"version": "2.5.1",
|
||||
"version": "2.6.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "echo 'skip it'",
|
||||
|
Loading…
Reference in New Issue
Block a user