Merge branch 'release/v2.6.0' into feature/refacroting-selector

This commit is contained in:
Timofey Boyko 2024-07-03 17:17:20 +03:00
commit da36241435
11 changed files with 84 additions and 38 deletions

View File

@ -173,7 +173,7 @@ const CreateRoomDialog = ({
>
<ModalDialog.Header>
<DialogHeader
disabledIcon={Boolean(startRoomParams)}
disabledIcon={Boolean(startRoomType)}
isChooseRoomType={!roomParams.type}
onArrowClick={goBack}
/>
@ -185,7 +185,7 @@ const CreateRoomDialog = ({
) : (
<SetRoomParams
t={t}
disabledChangeRoomType={Boolean(startRoomParams)}
disabledChangeRoomType={Boolean(startRoomType)}
setIsOauthWindowOpen={setIsOauthWindowOpen}
tagHandler={tagHandler}
roomParams={roomParams}

View File

@ -133,8 +133,9 @@ const ConfirmRoute = ({
window.location.href = combineUrl(
window.ClientConfig?.proxy?.url,
path,
"/error",
"/error?messageKey=21",
);
break;
case ValidationResult.Expired:
console.error("expired link", {

View File

@ -25,55 +25,94 @@
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
import { inject, observer } from "mobx-react";
import { StyledHistoryLink } from "../../../styles/history";
import { ActionByTarget } from "../FeedInfo";
import { decode } from "he";
import { Link } from "@docspace/shared/components/link";
import { toastr } from "@docspace/shared/components/toast";
import { withTranslation } from "react-i18next";
import { Text } from "@docspace/shared/components/text";
import { TTranslation } from "@docspace/shared/types";
import { StyledHistoryLink } from "../../../styles/history";
type TFeedData = {
access: number;
canEditAccess: boolean;
subjectType: number;
isOwner: boolean;
isLocked: boolean;
title?: string;
sharedTo?: {
title: string;
shareLink: string;
requestToken: string;
primary: boolean;
linkType: number;
isExpired: boolean;
internal: boolean;
id: string;
denyDownload: boolean;
};
};
interface HistoryRoomExternalLinkProps {
feed: any;
actionType: ActionByTarget<"roomTag">;
feedData: TFeedData;
roomId: number | string;
t: TTranslation;
canEditLink: boolean;
setEditLinkPanelIsVisible: (value: boolean) => void;
setLinkParams: (data: {
isEdit: boolean;
link: TFeedData;
roomId: number | string;
}) => void;
}
const HistoryRoomExternalLink = ({
t,
feed,
actionType,
feedData,
canEditLink,
setEditLinkPanelIsVisible,
setLinkParams,
roomId,
}: HistoryRoomExternalLinkProps) => {
const onEditLink = () => {
if (!feed.data.sharedTo) {
if (!feedData.sharedTo) {
toastr.error(t("FeedLinkWasDeleted"));
return;
}
setLinkParams({ isEdit: true, link: feed.data });
setLinkParams({ isEdit: true, link: feedData, roomId });
setEditLinkPanelIsVisible(true);
};
if (actionType === "create")
return (
<StyledHistoryLink>
{canEditLink ? (
<Link className="text link" onClick={onEditLink}>
{decode(feed.data.title || feed.data.sharedTo?.title)}
</Link>
) : (
<Text as="span" className="text">
{decode(feed.data.title || feed.data.sharedTo?.title)}
</Text>
)}
</StyledHistoryLink>
);
return (
<StyledHistoryLink>
{canEditLink ? (
<Link className="text link" onClick={onEditLink}>
{decode(feedData.title || feedData.sharedTo?.title)}
</Link>
) : (
<Text as="span" className="text">
{decode(feedData.title || feedData.sharedTo?.title)}
</Text>
)}
</StyledHistoryLink>
);
};
export default inject(({ userStore, dialogsStore }) => ({
canEditLink: !(userStore.user.isVisitor || userStore.user.isCollaborator),
setEditLinkPanelIsVisible: dialogsStore.setEditLinkPanelIsVisible,
setLinkParams: dialogsStore.setLinkParams,
}))(withTranslation(["InfoPanel"])(observer(HistoryRoomExternalLink)));
export default inject(({ userStore, dialogsStore, infoPanelStore }) => {
const { infoPanelSelection } = infoPanelStore;
const { setLinkParams, setEditLinkPanelIsVisible } = dialogsStore;
const { user } = userStore;
const { id } = infoPanelSelection;
const cannotEdit = user.isVisitor || user.isCollaborator;
return {
canEditLink: !cannotEdit,
setEditLinkPanelIsVisible,
setLinkParams,
roomId: id,
};
})(withTranslation(["InfoPanel"])(observer(HistoryRoomExternalLink)));

View File

@ -75,7 +75,7 @@ const HistoryBlockContent = ({
)}
{targetType === "roomExternalLink" && actionType === "create" && (
<HistoryRoomExternalLink feed={feed} actionType={actionType} />
<HistoryRoomExternalLink feedData={feed.data} />
)}
{targetType === "user" && actionType !== "update" && (

View File

@ -25,7 +25,7 @@
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
import { cookies, headers } from "next/headers";
import { redirect } from "next/navigation";
import { Toast } from "@docspace/shared/components/toast";
import { getBaseUrl } from "@docspace/shared/utils/next-ssr-helper";
import { TenantStatus, ThemeKeys } from "@docspace/shared/enums";
@ -83,7 +83,7 @@ export default async function RootLayout({
}
if (typeof settings !== "string" && settings?.wizardToken) {
redirectUrl = `wizard`;
redirect(`wizard`);
}
if (

View File

@ -46,4 +46,5 @@ export enum MessageKey {
"SsoAuthFailed",
"SsoAttributesNotFound",
"QuotaPaidUserLimitError",
"InvalidLink",
}

View File

@ -99,6 +99,8 @@ export const getMessageKeyTranslate = (t: TTranslation, message: string) => {
return t("Errors:SsoAttributesNotFound");
case "QuotaPaidUserLimitError":
return t("Common:QuotaPaidUserLimitError");
case "InvalidLink":
return t("Common:InvalidLink");
default:
return t("Common:Error");
}

View File

@ -38,7 +38,7 @@ export const YearsHeader = ({
isMobile,
}: YearsHeaderProps) => {
const selectedYear = observedDate.year();
const firstYear = selectedYear - (selectedYear % 10);
const firstYear = selectedYear;
const onLeftClick = () =>
setObservedDate((prevObservedDate) =>

View File

@ -162,8 +162,8 @@ const RoomIcon = ({
const titleWithoutNumberDuplicate = title?.replace(/\(\d+\)/, "");
const titleWithoutSpaces = titleWithoutNumberDuplicate
.replace(/\s+/g, " ")
.trim();
?.replace(/\s+/g, " ")
?.trim();
const indexAfterLastSpace = titleWithoutSpaces?.lastIndexOf(" ");
const secondCharacter =
!titleWithoutSpaces || indexAfterLastSpace === -1

View File

@ -49,7 +49,7 @@ import CatalogSettingsGiftReactSvgUrl from "PUBLIC_DIR/images/gift.react.svg?url
import CatalogSettingsStorageManagementReactSvgUrl from "PUBLIC_DIR/images/icons/16/catalog-settings-storage-management.svg?url";
import CatalogFolder20ReactSvgUrl from "PUBLIC_DIR/images/icons/20/catalog.folder.react.svg?url";
import CatalogUser20ReactSvgUrl from "PUBLIC_DIR/images/icons/20/catalog.user.react.svg?url";
import CatalogDocuments20ReactSvgUrl from "PUBLIC_DIR/images/icons/20/catalog.documents.react.svg?url";
import CatalogRooms20ReactSvgUrl from "PUBLIC_DIR/images/icons/20/catalog.rooms.react.svg?url";
import CatalogArchive20ReactSvgUrl from "PUBLIC_DIR/images/icons/20/catalog.archive.react.svg?url";
import CatalogShared20ReactSvgUrl from "PUBLIC_DIR/images/icons/20/catalog.shared.react.svg?url";
@ -114,7 +114,7 @@ const icons: Record<SizeType, Partial<Record<PageUnionType, string>>> = {
[PageType.storageManagement]: CatalogSettingsStorageManagementReactSvgUrl,
},
20: {
[FolderType.USER]: CatalogUser20ReactSvgUrl,
[FolderType.USER]: CatalogDocuments20ReactSvgUrl,
[FolderType.Rooms]: CatalogRooms20ReactSvgUrl,
[FolderType.Archive]: CatalogArchive20ReactSvgUrl,
[FolderType.SHARE]: CatalogShared20ReactSvgUrl,

View File

@ -0,0 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.28571 0C3.02335 0 2 1.11929 2 2.5V17.5C2 18.8807 3.02335 20 4.28571 20H15.7143C16.9767 20 18 18.8807 18 17.5V5.13889C18 4.81524 17.8852 4.5042 17.6798 4.27122L14.2513 0.382331C14.0359 0.138014 13.7389 0 13.4286 0H4.28571ZM4 2H13L16 5.38929V18H4V2ZM6 7H12V5H6V7ZM6 11H14V9H6V11ZM6 15H14V13H6V15Z" fill="#657077"/>
</svg>

After

Width:  |  Height:  |  Size: 468 B