Web: Client: JavascriptSDK: isolated shared link hint
This commit is contained in:
parent
9aff317033
commit
36e2bbbf38
@ -44,7 +44,6 @@ import { HelpButton } from "@docspace/shared/components/help-button";
|
||||
|
||||
import { TooltipContent } from "../sub-components/TooltipContent";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { Link } from "@docspace/shared/components/link";
|
||||
import FilesFilter from "@docspace/shared/api/files/filter";
|
||||
|
||||
import LeftMenuUrl from "PUBLIC_DIR/images/sdk-presets_left-menu.react.svg?url";
|
||||
@ -67,6 +66,7 @@ import { FrameIdSetter } from "../sub-components/FrameIdSetter";
|
||||
import { PresetWrapper } from "../sub-components/PresetWrapper";
|
||||
import { CodeToInsert } from "../sub-components/CodeToInsert";
|
||||
import { GetCodeBlock } from "../sub-components/GetCodeBlock";
|
||||
import { SharedLinkHint } from "../sub-components/SharedLinkHint";
|
||||
|
||||
import {
|
||||
showPreviewThreshold,
|
||||
@ -124,12 +124,6 @@ const Manager = (props) => {
|
||||
{ key: "Activity", label: t("Files:ByLastModified") },
|
||||
]);
|
||||
|
||||
const settingsTranslations = {
|
||||
password: t("Common:Password").toLowerCase(),
|
||||
denyDownload: t("FileContentCopy").toLowerCase(),
|
||||
expirationDate: t("LimitByTime").toLowerCase(),
|
||||
};
|
||||
|
||||
const [sortBy, setSortBy] = useState(dataSortBy[0]);
|
||||
const [sortOrder, setSortOrder] = useState(dataSortOrder[0]);
|
||||
const [withSubfolders, setWithSubfolders] = useState(false);
|
||||
@ -391,6 +385,8 @@ const Manager = (props) => {
|
||||
filter.folder = id;
|
||||
navigate(`/rooms/shared/${id}/filter?${filter.toUrlParams()}`);
|
||||
};
|
||||
|
||||
const redirectToSelectedRoom = () => navigateRoom(config.id);
|
||||
|
||||
const onResize = () => {
|
||||
const isEnoughWidthForPreview = window.innerWidth > showPreviewThreshold;
|
||||
@ -643,81 +639,12 @@ const Manager = (props) => {
|
||||
directionY="bottom"
|
||||
/>
|
||||
|
||||
{selectedLink && selectedLink.settings.length === 1 ? (
|
||||
<div>
|
||||
<Text
|
||||
className="linkHelp"
|
||||
fontSize="12px"
|
||||
lineHeight="16px"
|
||||
>
|
||||
{t("LinkSetDescription", {
|
||||
parameter:
|
||||
settingsTranslations[selectedLink.settings[0]],
|
||||
})}
|
||||
</Text>
|
||||
<Link
|
||||
color={currentColorScheme?.main?.accent}
|
||||
fontSize="12px"
|
||||
lineHeight="16px"
|
||||
onClick={() => navigateRoom(config.id)}
|
||||
>
|
||||
{" "}
|
||||
{t("GoToRoom")}.
|
||||
</Link>
|
||||
</div>
|
||||
) : selectedLink.settings.length === 2 ? (
|
||||
<div>
|
||||
<Text
|
||||
className="linkHelp"
|
||||
fontSize="12px"
|
||||
lineHeight="16px"
|
||||
>
|
||||
{t("LinkSetDescription2", {
|
||||
parameter1:
|
||||
settingsTranslations[selectedLink.settings[0]],
|
||||
parameter2:
|
||||
settingsTranslations[selectedLink.settings[1]],
|
||||
})}
|
||||
</Text>
|
||||
<Link
|
||||
color={currentColorScheme?.main?.accent}
|
||||
fontSize="12px"
|
||||
lineHeight="16px"
|
||||
onClick={() => navigateRoom(config.id)}
|
||||
>
|
||||
{" "}
|
||||
{t("GoToRoom")}.
|
||||
</Link>
|
||||
</div>
|
||||
) : selectedLink.settings.length === 3 ? (
|
||||
<div>
|
||||
<Text
|
||||
className="linkHelp"
|
||||
fontSize="12px"
|
||||
lineHeight="16px"
|
||||
>
|
||||
{t("LinkSetDescription3", {
|
||||
parameter1:
|
||||
settingsTranslations[selectedLink.settings[0]],
|
||||
parameter2:
|
||||
settingsTranslations[selectedLink.settings[1]],
|
||||
parameter3:
|
||||
settingsTranslations[selectedLink.settings[2]],
|
||||
})}
|
||||
</Text>
|
||||
<Link
|
||||
color={currentColorScheme?.main?.accent}
|
||||
fontSize="12px"
|
||||
lineHeight="16px"
|
||||
onClick={() => navigateRoom(config.id)}
|
||||
>
|
||||
{" "}
|
||||
{t("GoToRoom")}.
|
||||
</Link>
|
||||
</div>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
{selectedLink && <SharedLinkHint
|
||||
t={t}
|
||||
linkSettings={selectedLink.settings}
|
||||
redirectToSelectedRoom={redirectToSelectedRoom}
|
||||
currentColorScheme={currentColorScheme}
|
||||
/>}
|
||||
</ControlsGroup>
|
||||
)}
|
||||
</ControlsSection>
|
||||
|
@ -39,14 +39,10 @@ import { inject, observer } from "mobx-react";
|
||||
import { HelpButton } from "@docspace/shared/components/help-button";
|
||||
import { Checkbox } from "@docspace/shared/components/checkbox";
|
||||
|
||||
import GetCodeDialog from "../sub-components/GetCodeDialog";
|
||||
import { Button } from "@docspace/shared/components/button";
|
||||
|
||||
import EmptyIframeContainer from "../sub-components/EmptyIframeContainer";
|
||||
|
||||
import { TooltipContent } from "../sub-components/TooltipContent";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { Link } from "@docspace/shared/components/link";
|
||||
import FilesFilter from "@docspace/shared/api/files/filter";
|
||||
|
||||
import { RoomsType } from "@docspace/shared/enums";
|
||||
@ -63,6 +59,7 @@ import { FrameIdSetter } from "../sub-components/FrameIdSetter";
|
||||
import { PresetWrapper } from "../sub-components/PresetWrapper";
|
||||
import { CodeToInsert } from "../sub-components/CodeToInsert";
|
||||
import { GetCodeBlock } from "../sub-components/GetCodeBlock";
|
||||
import { SharedLinkHint } from "../sub-components/SharedLinkHint";
|
||||
|
||||
import {
|
||||
showPreviewThreshold,
|
||||
@ -94,12 +91,6 @@ const SimpleRoom = (props) => {
|
||||
|
||||
setDocumentTitle(t("JavascriptSdk"));
|
||||
|
||||
const settingsTranslations = {
|
||||
password: t("Common:Password").toLowerCase(),
|
||||
denyDownload: t("FileContentCopy").toLowerCase(),
|
||||
expirationDate: t("LimitByTime").toLowerCase(),
|
||||
};
|
||||
|
||||
const [showPreview, setShowPreview] = useState(
|
||||
window.innerWidth > showPreviewThreshold,
|
||||
);
|
||||
@ -244,6 +235,8 @@ const SimpleRoom = (props) => {
|
||||
navigate(`/rooms/shared/${id}/filter?${filter.toUrlParams()}`);
|
||||
};
|
||||
|
||||
const redirectToSelectedRoom = () => navigateRoom(config.id);
|
||||
|
||||
useEffect(() => {
|
||||
window.addEventListener("resize", onResize);
|
||||
return () => {
|
||||
@ -363,80 +356,13 @@ const SimpleRoom = (props) => {
|
||||
displaySelectedOption
|
||||
directionY="bottom"
|
||||
/>
|
||||
{selectedLink && selectedLink.settings.length === 1 ? (
|
||||
<div>
|
||||
<Text
|
||||
className="linkHelp"
|
||||
fontSize="12px"
|
||||
lineHeight="16px"
|
||||
>
|
||||
{t("LinkSetDescription", {
|
||||
parameter:
|
||||
settingsTranslations[selectedLink.settings[0]],
|
||||
})}
|
||||
</Text>
|
||||
<Link
|
||||
color={currentColorScheme?.main?.accent}
|
||||
fontSize="12px"
|
||||
lineHeight="16px"
|
||||
onClick={() => navigateRoom(config.id)}
|
||||
>
|
||||
{" "}
|
||||
{t("GoToRoom")}.
|
||||
</Link>
|
||||
</div>
|
||||
) : selectedLink.settings.length === 2 ? (
|
||||
<div>
|
||||
<Text
|
||||
className="linkHelp"
|
||||
fontSize="12px"
|
||||
lineHeight="16px"
|
||||
>
|
||||
{t("LinkSetDescription2", {
|
||||
parameter1:
|
||||
settingsTranslations[selectedLink.settings[0]],
|
||||
parameter2:
|
||||
settingsTranslations[selectedLink.settings[1]],
|
||||
})}
|
||||
</Text>
|
||||
<Link
|
||||
color={currentColorScheme?.main?.accent}
|
||||
fontSize="12px"
|
||||
lineHeight="16px"
|
||||
onClick={() => navigateRoom(config.id)}
|
||||
>
|
||||
{" "}
|
||||
{t("GoToRoom")}.
|
||||
</Link>
|
||||
</div>
|
||||
) : selectedLink.settings.length === 3 ? (
|
||||
<div>
|
||||
<Text
|
||||
className="linkHelp"
|
||||
fontSize="12px"
|
||||
lineHeight="16px"
|
||||
>
|
||||
{t("LinkSetDescription3", {
|
||||
parameter1:
|
||||
settingsTranslations[selectedLink.settings[0]],
|
||||
parameter2:
|
||||
settingsTranslations[selectedLink.settings[1]],
|
||||
parameter3:
|
||||
settingsTranslations[selectedLink.settings[2]],
|
||||
})}
|
||||
</Text>
|
||||
<Link
|
||||
color={currentColorScheme?.main?.accent}
|
||||
fontSize="12px"
|
||||
lineHeight="16px"
|
||||
onClick={() => navigateRoom(config.id)}
|
||||
>
|
||||
{" "}
|
||||
{t("GoToRoom")}.
|
||||
</Link>
|
||||
</div>
|
||||
) : (
|
||||
<></>
|
||||
{selectedLink && (
|
||||
<SharedLinkHint
|
||||
t={t}
|
||||
linkSettings={selectedLink.settings}
|
||||
redirectToSelectedRoom={redirectToSelectedRoom}
|
||||
currentColorScheme={currentColorScheme}
|
||||
/>
|
||||
)}
|
||||
</ControlsGroup>
|
||||
)}
|
||||
|
@ -0,0 +1,73 @@
|
||||
// (c) Copyright Ascensio System SIA 2009-2024
|
||||
//
|
||||
// This program is a free software product.
|
||||
// You can redistribute it and/or modify it under the terms
|
||||
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
||||
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
||||
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
||||
// any third-party rights.
|
||||
//
|
||||
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
||||
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
//
|
||||
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
||||
//
|
||||
// The interactive user interfaces in modified source and object code versions of the Program must
|
||||
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
||||
//
|
||||
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
||||
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
||||
// trademark law for use of our trademarks.
|
||||
//
|
||||
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
||||
// 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 { Link } from "@docspace/shared/components/link";
|
||||
import { Text } from "@docspace/shared/components/text";
|
||||
|
||||
export const SharedLinkHint = ({
|
||||
t,
|
||||
linkSettings,
|
||||
redirectToSelectedRoom,
|
||||
currentColorScheme,
|
||||
}) => {
|
||||
const settingsTranslations = {
|
||||
password: t("Common:Password").toLowerCase(),
|
||||
denyDownload: t("FileContentCopy").toLowerCase(),
|
||||
expirationDate: t("LimitByTime").toLowerCase(),
|
||||
};
|
||||
|
||||
return (
|
||||
linkSettings.length > 0 && (
|
||||
<div>
|
||||
<Text className="linkHelp" fontSize="12px" lineHeight="16px">
|
||||
{linkSettings.length === 2
|
||||
? t("LinkSetDescription2", {
|
||||
parameter1: settingsTranslations[linkSettings[0]],
|
||||
parameter2: settingsTranslations[linkSettings[1]],
|
||||
})
|
||||
: linkSettings.length === 3
|
||||
? t("LinkSetDescription3", {
|
||||
parameter1: settingsTranslations[linkSettings[0]],
|
||||
parameter2: settingsTranslations[linkSettings[1]],
|
||||
parameter3: settingsTranslations[linkSettings[2]],
|
||||
})
|
||||
: t("LinkSetDescription", {
|
||||
parameter: settingsTranslations[linkSettings[0]],
|
||||
})}
|
||||
</Text>
|
||||
<Link
|
||||
color={currentColorScheme?.main?.accent}
|
||||
fontSize="12px"
|
||||
lineHeight="16px"
|
||||
onClick={redirectToSelectedRoom}
|
||||
>
|
||||
{" "}
|
||||
{t("GoToRoom")}.
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
};
|
Loading…
Reference in New Issue
Block a user