Merge branch 'develop' into feature/security-active-sessions

This commit is contained in:
Alexey Safronov 2024-07-11 16:18:41 +04:00
commit 5bfd73afc6
10 changed files with 113 additions and 46 deletions

View File

@ -314,6 +314,7 @@ const useFiles = ({
fromTemplate: true,
title: gallerySelected.attributes.name_form,
openEditor: !isFormRoom,
edit: true,
};
event.payload = payload;

View File

@ -70,7 +70,7 @@ const tagList = (tags, selectTag) => (
key={i}
className="property-tag"
label={tag}
onClick={() => selectTag(tag)}
onClick={() => selectTag({ label: tag })}
/>
))}
</div>

View File

@ -67,7 +67,7 @@ const AccountsTable = (props) => {
},
{
key: UserTypes.RoomAdmin,
label: t(`Common:${UserTypes.RoomAdmin}`),
label: t("Common:RoomAdmin"),
onClick: setTypeRoomAdmin,
},
{

View File

@ -265,6 +265,7 @@ const BruteForceProtection = (props) => {
<FieldContainer
className="input-container"
labelVisible={true}
labelText={t("NumberOfAttempts")}
isVertical={true}
place="top"
@ -284,6 +285,7 @@ const BruteForceProtection = (props) => {
<FieldContainer
className="input-container"
labelVisible={true}
labelText={t("BlockingTime")}
isVertical={true}
place="top"
@ -303,6 +305,7 @@ const BruteForceProtection = (props) => {
<FieldContainer
className="input-container"
labelVisible={true}
labelText={t("CheckPeriod")}
isVertical={true}
place="top"

View File

@ -401,6 +401,7 @@ class DialogsStore {
templateId: fileInfo.id,
withoutDialog,
preview,
edit: true,
};
event.payload = payload;

View File

@ -189,21 +189,29 @@ const Editor = ({
}
const customization = new URLSearchParams(search).get("customization");
const sdkCustomization: NonNullable<
IConfig["editorConfig"]
>["customization"] = JSON.parse(customization || "{}");
const theme = sdkCustomization?.uiTheme || user?.theme;
if (newConfig.editorConfig)
if (newConfig.editorConfig) {
newConfig.editorConfig.customization = {
...newConfig.editorConfig.customization,
...sdkCustomization,
goback: { ...goBack },
close: { visible: SHOW_CLOSE, text: t("Common:CloseButton") },
uiTheme: getEditorTheme(theme as ThemeKeys),
};
if (SHOW_CLOSE) {
newConfig.editorConfig.customization.close = {
visible: SHOW_CLOSE,
text: t("Common:CloseButton"),
};
}
}
//if (newConfig.document && newConfig.document.info)
// newConfig.document.info.favorite = false;

View File

@ -153,6 +153,7 @@ const LinkRow = ({
modernView
type="onlyIcon"
isDisabled={isExpiredLink || isLoaded}
manualWidth="fit-content"
/>
</div>
</StyledLinkRow>

View File

@ -57,11 +57,18 @@ export const StyledTabs = styled.div<{
width: 60px;
pointer-events: none;
background: linear-gradient(
background: ${(props) =>
props.theme.interfaceDirection === "ltr"
? `linear-gradient(
90deg,
rgba(255, 255, 255, 0) 20.48%,
${(props) => props.theme.tabs.gradientColor} 100%
);
${props.theme.tabs.gradientColor} 100%
)`
: `linear-gradient(
270deg,
rgba(255, 255, 255, 0) 20.48%,
${props.theme.tabs.gradientColor} 100%)`};
transform: matrix(-1, 0, 0, 1, 0, 0);
z-index: 1;
@ -71,14 +78,29 @@ export const StyledTabs = styled.div<{
position: absolute;
height: 32px;
width: 60px;
right: 0;
pointer-events: none;
background: linear-gradient(
${(props) =>
props.theme.interfaceDirection === "ltr"
? css`
right: 0;
`
: css`
left: 0;
`}
background: ${(props) =>
props.theme.interfaceDirection === "ltr"
? `linear-gradient(
90deg,
rgba(255, 255, 255, 0) 20.48%,
${(props) => props.theme.tabs.gradientColor} 100%
);
${props.theme.tabs.gradientColor} 100%
)`
: `linear-gradient(
270deg,
rgba(255, 255, 255, 0) 20.48%,
${props.theme.tabs.gradientColor} 100%)`};
z-index: 1;
}

View File

@ -24,7 +24,8 @@
// 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 React, { useState, useRef, useEffect } from "react";
import React, { useState, useRef, useEffect, useCallback } from "react";
import { useTheme } from "styled-components";
import { Scrollbar as ScrollbarType } from "../scrollbar/custom-scrollbar";
@ -51,6 +52,8 @@ const Tabs = (props: TabsProps) => {
...rest
} = props;
const theme = useTheme();
let selectedItemIndex = items.findIndex((item) => item.id === selectedItemId);
if (selectedItemIndex === INDEX_NOT_FOUND) {
selectedItemIndex = 0;
@ -66,33 +69,60 @@ const Tabs = (props: TabsProps) => {
const isViewFirstTab = useViewTab(scrollRef, tabsRef, 0);
const isViewLastTab = useViewTab(scrollRef, tabsRef, items.length - 1);
const scrollToTab = useCallback(
(index: number): void => {
if (!scrollRef.current || !tabsRef.current) return;
const containerElement = scrollRef.current.scrollerElement;
const tabElement = tabsRef.current.children[index] as HTMLDivElement;
if (!containerElement || !tabElement) return;
const containerWidth = containerElement.offsetWidth;
const tabWidth = tabElement?.offsetWidth;
const tabOffsetLeft = tabElement?.offsetLeft;
if (theme.interfaceDirection === "ltr") {
if (tabOffsetLeft - OFFSET_LEFT < containerElement.scrollLeft) {
scrollRef.current.scrollTo(tabOffsetLeft - OFFSET_LEFT);
} else if (
tabOffsetLeft + tabWidth >
containerElement.scrollLeft + containerWidth
) {
scrollRef.current.scrollTo(
tabOffsetLeft - containerWidth + tabWidth + OFFSET_RIGHT,
);
}
return;
}
const rect = tabElement?.getBoundingClientRect();
if (rect.left - OFFSET_LEFT < 0) {
scrollRef.current.scrollTo(
-(
Math.abs(rect.left) +
OFFSET_LEFT +
Math.abs(containerElement.scrollLeft)
),
);
} else if (rect.right > containerWidth && !!containerElement.scrollLeft) {
scrollRef.current.scrollTo(
rect.right -
containerWidth +
containerElement.scrollLeft +
OFFSET_RIGHT,
);
}
},
[theme.interfaceDirection],
);
useEffect(() => {
setCurrentItem(items[selectedItemIndex]);
}, [selectedItemIndex, items]);
const scrollToTab = (index: number): void => {
if (!scrollRef.current || !tabsRef.current) return;
const containerElement = scrollRef.current.scrollerElement;
const tabElement = tabsRef.current.children[index] as HTMLDivElement;
if (!containerElement || !tabElement) return;
const containerWidth = containerElement.offsetWidth;
const tabWidth = tabElement?.offsetWidth;
const tabOffsetLeft = tabElement.offsetLeft;
if (tabOffsetLeft - OFFSET_LEFT < containerElement.scrollLeft) {
scrollRef.current.scrollTo(tabOffsetLeft - OFFSET_LEFT);
} else if (
tabOffsetLeft + tabWidth >
containerElement.scrollLeft + containerWidth
) {
scrollRef.current.scrollTo(
tabOffsetLeft - containerWidth + tabWidth + OFFSET_RIGHT,
);
}
};
scrollToTab(selectedItemIndex);
}, [selectedItemIndex, items, scrollToTab]);
const setSelectedItem = (selectedTabItem: TTabItem, index: number): void => {
setCurrentItem(selectedTabItem);
@ -116,7 +146,8 @@ const Tabs = (props: TabsProps) => {
$type={type}
onClick={() => {
item.onClick?.();
setSelectedItem(item, index);
return setSelectedItem(item, index);
}}
>
{item.name}

View File

@ -73,21 +73,21 @@ export const createRequest = (
if (authToken) hdrs.set("Authorization", authToken);
const allCookie = cookieStore.getAll();
const sharedLink = allCookie
cookieStore
.getAll()
.map((c) => {
if (c.name.includes("sharedlink")) {
if (c.name.includes("sharelink")) {
return c;
}
return false;
})
.filter((v) => !!v);
.filter((v) => !!v)
.forEach((value) => {
hdrs.set(value.name, value.value);
if (sharedLink[0]) {
hdrs.set(sharedLink[0].name, sharedLink[0].value);
}
return value;
});
const urls = paths.map((path) => `${apiURL}${path}`);