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, fromTemplate: true,
title: gallerySelected.attributes.name_form, title: gallerySelected.attributes.name_form,
openEditor: !isFormRoom, openEditor: !isFormRoom,
edit: true,
}; };
event.payload = payload; event.payload = payload;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -24,7 +24,8 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 // 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 // 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"; import { Scrollbar as ScrollbarType } from "../scrollbar/custom-scrollbar";
@ -51,6 +52,8 @@ const Tabs = (props: TabsProps) => {
...rest ...rest
} = props; } = props;
const theme = useTheme();
let selectedItemIndex = items.findIndex((item) => item.id === selectedItemId); let selectedItemIndex = items.findIndex((item) => item.id === selectedItemId);
if (selectedItemIndex === INDEX_NOT_FOUND) { if (selectedItemIndex === INDEX_NOT_FOUND) {
selectedItemIndex = 0; selectedItemIndex = 0;
@ -66,33 +69,60 @@ const Tabs = (props: TabsProps) => {
const isViewFirstTab = useViewTab(scrollRef, tabsRef, 0); const isViewFirstTab = useViewTab(scrollRef, tabsRef, 0);
const isViewLastTab = useViewTab(scrollRef, tabsRef, items.length - 1); 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(() => { useEffect(() => {
setCurrentItem(items[selectedItemIndex]); setCurrentItem(items[selectedItemIndex]);
}, [selectedItemIndex, items]); scrollToTab(selectedItemIndex);
}, [selectedItemIndex, items, scrollToTab]);
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,
);
}
};
const setSelectedItem = (selectedTabItem: TTabItem, index: number): void => { const setSelectedItem = (selectedTabItem: TTabItem, index: number): void => {
setCurrentItem(selectedTabItem); setCurrentItem(selectedTabItem);
@ -116,7 +146,8 @@ const Tabs = (props: TabsProps) => {
$type={type} $type={type}
onClick={() => { onClick={() => {
item.onClick?.(); item.onClick?.();
setSelectedItem(item, index);
return setSelectedItem(item, index);
}} }}
> >
{item.name} {item.name}

View File

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