Skip to content

Commit 82c198b

Browse files
Merge branch 'agora-integrationn' of https://github.com/lowcoder-org/lowcoder into agora-integrationn
2 parents 6ca3d4d + cf0fac6 commit 82c198b

File tree

5 files changed

+286
-3
lines changed

5 files changed

+286
-3
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import { Drawer as AntdDrawer, DrawerProps as AntdDrawerProps } from "antd";
2+
import Handle from "./Modal/handler";
3+
import { useEffect, useMemo, useState } from "react";
4+
import { Resizable, ResizeHandle } from "react-resizable";
5+
import { useResizeDetector } from "react-resize-detector";
6+
import styled from "styled-components";
7+
8+
const StyledMeeting = styled(AntdDrawer)`
9+
& .ant-drawer-content-wrapper {
10+
transition-duration: 0s;
11+
}
12+
`;
13+
14+
type Placement = "top" | "bottom" | "left" | "right";
15+
function getResizeHandle(placement?: Placement): ResizeHandle {
16+
switch (placement) {
17+
case "top":
18+
return "s";
19+
case "bottom":
20+
return "n";
21+
case "left":
22+
return "e";
23+
}
24+
return "w";
25+
}
26+
27+
type MeetingProps = {
28+
resizable?: boolean;
29+
onResizeStart?: (
30+
e: React.SyntheticEvent,
31+
node: HTMLElement,
32+
size: { width: number; height: number },
33+
handle: ResizeHandle
34+
) => void;
35+
onResize?: (
36+
e: React.SyntheticEvent,
37+
node: HTMLElement,
38+
size: { width: number; height: number },
39+
handle: ResizeHandle
40+
) => void;
41+
onResizeStop?: (
42+
e: React.SyntheticEvent,
43+
node: HTMLElement,
44+
size: { width: number; height: number },
45+
handle: ResizeHandle
46+
) => void;
47+
} & AntdDrawerProps;
48+
49+
export function Meeting(props: MeetingProps) {
50+
const { resizable, width: drawerWidth, height: drawerHeight, children, ...otherProps } = props;
51+
const placement = useMemo(() => props.placement ?? "right", [props.placement]);
52+
const resizeHandles = useMemo(
53+
() => (resizable ? [getResizeHandle(placement)] : []),
54+
[placement, resizable]
55+
);
56+
const isTopBom = ["top", "bottom"].includes(placement);
57+
const [width, setWidth] = useState<number>();
58+
const [height, setHeight] = useState<number>();
59+
useEffect(() => {
60+
setWidth(undefined);
61+
// eslint-disable-next-line react-hooks/exhaustive-deps
62+
}, [drawerWidth]);
63+
useEffect(() => {
64+
setHeight(undefined);
65+
// eslint-disable-next-line react-hooks/exhaustive-deps
66+
}, [drawerHeight]);
67+
const { width: detectWidth, height: detectHeight, ref } = useResizeDetector();
68+
// log.info("Drawer. drawerWidth: ", drawerWidth, " width: ", width, "detectWidth: ", detectWidth);
69+
return (
70+
<StyledMeeting width={width ?? drawerWidth} height={height ?? drawerHeight} {...otherProps}>
71+
<Resizable
72+
width={width ?? detectWidth ?? 0}
73+
height={height ?? detectHeight ?? 0}
74+
resizeHandles={resizeHandles}
75+
handle={Handle}
76+
onResizeStart={(event, { node, size, handle }) =>
77+
props.onResizeStart?.(event, node, size, handle)
78+
}
79+
onResize={(event, { node, size, handle }) => {
80+
isTopBom ? setHeight(size.height) : setWidth(size.width);
81+
props.onResize?.(event, node, size, handle);
82+
}}
83+
onResizeStop={(event, { node, size, handle }) =>
84+
props.onResizeStop?.(event, node, size, handle)
85+
}
86+
>
87+
<div ref={ref} style={{ height: "100%" }}>
88+
{children}
89+
</div>
90+
</Resizable>
91+
</StyledMeeting>
92+
);
93+
}

client/packages/lowcoder-design/src/icons/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ export { ReactComponent as AudioCompIcon } from "./icon-insert-audio.svg";
168168
export { ReactComponent as VideoCompIcon } from "./icon-insert-video.svg";
169169
export { ReactComponent as videoPlayTriangle } from "./icon-video-play-triangle.svg";
170170
export { ReactComponent as DrawerCompIcon } from "./icon-drawer.svg";
171+
export { ReactComponent as LeftMeetingIcon } from "./icon-left-comp-video.svg";
171172
export { ReactComponent as PlusIcon } from "./icon-plus.svg";
172173
export { ReactComponent as HomeIcon } from "./icon-application-home.svg";
173174
export { ReactComponent as HomeModuleIcon } from "./icon-application-module.svg";
@@ -236,6 +237,7 @@ export { ReactComponent as LeftContainer } from "./icon-left-comp-container.svg"
236237
export { ReactComponent as LeftDate } from "./icon-left-comp-date.svg";
237238
export { ReactComponent as LeftDivider } from "./icon-left-comp-divider.svg";
238239
export { ReactComponent as LeftDrawer } from "./icon-left-comp-drawer.svg";
240+
export { ReactComponent as LeftMeeting } from "./icon-left-comp-video.svg";
239241
export { ReactComponent as LeftFile } from "./icon-left-comp-file.svg";
240242
export { ReactComponent as LeftFileViewer } from "./icon-left-comp-fileViewer.svg";
241243
export { ReactComponent as LeftForm } from "./icon-left-comp-form.svg";

client/packages/lowcoder-design/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export * from "./components/Collapase";
22
export * from "./components/CustomModal";
3-
export * from "./components/Drawer";
3+
export * from "./components/Drawer";
4+
export * from "./components/Meeting";
45
export * from "./components/Dropdown";
56
export * from "./components/ExternalLink";
67
export * from "./components/GlobalInstances";

client/packages/lowcoder/src/comps/comps/videoComp/videoMeetingComp.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,15 @@ let VideoCompBuilder = (function (props) {
216216
})
217217
.setPropertyViewFn((children) => (
218218
<>
219-
<Section name={sectionNames.settings}>
219+
{/* <Section name={sectionNames.settings}>
220220
{children.userId.propertyView({
221221
label: trans("meeting.userId"),
222222
})}
223223
{children.autoHeight.getPropertyView()}
224224
{children.videokey.propertyView({
225225
label: trans("prop.videokey"),
226226
})}
227-
</Section>
227+
</Section> */}
228228
{/* <Section name={sectionNames.layout}>
229229
{/* {hiddenPropertyView(children)}
230230
</Section> */}

0 commit comments

Comments
 (0)