Merge branch 'develop' into feature/templates

This commit is contained in:
Nikita Gopienko 2024-04-24 14:34:21 +03:00
commit 9a94909537
11 changed files with 57 additions and 37 deletions

View File

@ -920,7 +920,6 @@ export default inject(
const isFolder = selectedFolderStore.isFolder; const isFolder = selectedFolderStore.isFolder;
const { isAdmin, isOwner, isRoomAdmin } = userStore.user; const { isAdmin, isOwner, isRoomAdmin } = userStore.user;
console.log(userStore.user);
const { isGracePeriod } = currentTariffStatusStore; const { isGracePeriod } = currentTariffStatusStore;
const { setOformFromFolderId, oformsFilter } = oformsStore; const { setOformFromFolderId, oformsFilter } = oformsStore;

View File

@ -134,11 +134,6 @@ const TagDropdown = ({
const dropdownItems = calcualateDisplayedDropdownItems(); const dropdownItems = calcualateDisplayedDropdownItems();
return ( return (
<StyledDropDownWrapper
ref={dropdownRef}
className="dropdown-content-wrapper"
onMouseDown={preventDefault}
>
<StyledDropDown <StyledDropDown
className="dropdown-content" className="dropdown-content"
open={open} open={open}
@ -148,10 +143,11 @@ const TagDropdown = ({
hasItems={!!dropdownItems.length} hasItems={!!dropdownItems.length}
clickOutsideAction={onClickOutside} clickOutsideAction={onClickOutside}
withBackdrop={false} withBackdrop={false}
isDefaultMode={false}
manualY="54px"
> >
{dropdownItems} {dropdownItems}
</StyledDropDown> </StyledDropDown>
</StyledDropDownWrapper>
); );
}; };

View File

@ -33,6 +33,8 @@ import InputParam from "../Params/InputParam";
import TagDropdown from "./TagDropdown"; import TagDropdown from "./TagDropdown";
const StyledTagInput = styled.div` const StyledTagInput = styled.div`
position: relative;
.set_room_params-tag_input { .set_room_params-tag_input {
&-label_wrapper { &-label_wrapper {
&-label { &-label {

View File

@ -44,13 +44,14 @@ const RoomCell = ({ sideColor, item }) => {
setIsTooltipLoading(true); setIsTooltipLoading(true);
try { try {
const folderPath = await getFolderPath(originId); const folderPath = await getFolderPath(originId);
if (folderPath[0].id === CategoryType.Shared) folderPath.shift(); if (folderPath[0].id === CategoryType.SharedRoom) folderPath.shift();
setPath(folderPath); setPath(folderPath);
} catch (e) { } catch (e) {
console.error(e); console.error(e);
setPath([{ id: 0, title: originRoomTitle || originTitle }]); setPath([{ id: 0, title: originRoomTitle || originTitle }]);
} } finally {
setIsTooltipLoading(false); setIsTooltipLoading(false);
}
}; };
const canVisibleTitle = originRoomTitle || originTitle; const canVisibleTitle = originRoomTitle || originTitle;

View File

@ -3997,12 +3997,12 @@ class FilesStore {
}); });
}; };
//Duplicate of countTilesInRow, used to update the number of tiles in a row after the window is resized. //Used to update the number of tiles in a row after the window is resized.
getCountTilesInRow = () => { getCountTilesInRow = () => {
const isDesktopView = isDesktop(); const isDesktopView = isDesktop();
const isMobileView = isMobile();
const tileGap = isDesktopView ? 16 : 14; const tileGap = isDesktopView ? 16 : 14;
const minTileWidth = 216 + tileGap; const minTileWidth = 216 + tileGap;
const body = document.getElementById("section");
const elem = document.getElementsByClassName("section-wrapper-content")[0]; const elem = document.getElementsByClassName("section-wrapper-content")[0];
let containerWidth = 0; let containerWidth = 0;
@ -4017,10 +4017,11 @@ class FilesStore {
elemPadding.split("px")[3]; elemPadding.split("px")[3];
} }
const sectionPadding = body?.offsetWidth - containerWidth - tileGap + 1; containerWidth += tileGap;
const sectionWidth = body ? body.offsetWidth - sectionPadding : 0; if (!isMobileView) containerWidth -= 1;
if (!isDesktopView) containerWidth += 3; //tablet tile margin -3px (TileContainer.js)
return Math.floor(sectionWidth / minTileWidth); return Math.floor(containerWidth / minTileWidth);
}; };
setInvitationLinks = async (roomId, title, access, linkId) => { setInvitationLinks = async (roomId, title, access, linkId) => {

View File

@ -694,15 +694,7 @@ class HotkeyStore {
}; };
get countTilesInRow() { get countTilesInRow() {
const isDesktopView = isDesktop(); return this.filesStore.getCountTilesInRow();
const tileGap = isDesktopView ? 16 : 14;
const minTileWidth = 216 + tileGap;
const sectionPadding = isDesktopView ? 24 : 16;
const body = document.getElementById("section");
const sectionWidth = body ? body.offsetWidth - sectionPadding : 0;
return Math.floor(sectionWidth / minTileWidth);
} }
get division() { get division() {

View File

@ -137,7 +137,6 @@ export async function getFolderPath(folderId: number) {
}; };
const res = (await request(options)) as TGetFolderPath; const res = (await request(options)) as TGetFolderPath;
return res; return res;
} }

View File

@ -79,7 +79,8 @@ const StyledIcon = styled.div<{
.room-icon_badge { .room-icon_badge {
position: absolute; position: absolute;
margin: 24px 0 0 24px; margin-block: 24px 0;
margin-inline: 24px 0;
.room-icon-button { .room-icon-button {
width: 12px; width: 12px;

View File

@ -28,6 +28,8 @@
import React from "react"; import React from "react";
import { ButtonKeys } from "../../enums";
import { Header } from "./sub-components/Header"; import { Header } from "./sub-components/Header";
import { Body } from "./sub-components/Body"; import { Body } from "./sub-components/Body";
import { Footer } from "./sub-components/Footer"; import { Footer } from "./sub-components/Footer";
@ -383,6 +385,19 @@ const Selector = ({
setFooterVisible(isEqual); setFooterVisible(isEqual);
}, [selectedItems, newSelectedItems]); }, [selectedItems, newSelectedItems]);
React.useEffect(() => {
const onKeyboardAction = (e: KeyboardEvent) => {
if (e.key === ButtonKeys.esc) {
onCancel?.();
}
};
window.addEventListener("keydown", onKeyboardAction);
return () => {
window.removeEventListener("keydown", onKeyboardAction);
};
}, [onCancel]);
React.useLayoutEffect(() => { React.useLayoutEffect(() => {
if (items) { if (items) {
if ( if (

View File

@ -116,6 +116,20 @@ const Tooltip = React.forwardRef<TooltipRefProps, TooltipProps>(
flip({ flip({
crossAxis: false, crossAxis: false,
fallbackAxisSideDirection, fallbackAxisSideDirection,
fallbackPlacements: [
"right",
"bottom",
"left",
"top",
"top-start",
"top-end",
"right-start",
"right-end",
"bottom-start",
"bottom-end",
"left-start",
"left-end",
],
}), }),
shift(), shift(),
]} ]}

View File

@ -455,7 +455,7 @@ export const enum ParseErrorTypes {
export const enum ButtonKeys { export const enum ButtonKeys {
enter = "enter", enter = "enter",
esc = "esc", esc = "Escape",
tab = "Tab", tab = "Tab",
} }