@100mslive/roomkit-react 0.3.5-alpha.0 → 0.3.5-alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{HLSView-GF23J3TJ.js → HLSView-I6DCFRWE.js} +2 -2
- package/dist/Prebuilt/components/hooks/useCloseScreenshareWhiteboard.d.ts +1 -1
- package/dist/{chunk-7O27GQEH.js → chunk-ZE5KXBZW.js} +628 -639
- package/dist/chunk-ZE5KXBZW.js.map +7 -0
- package/dist/index.cjs.js +376 -388
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.js +1 -1
- package/dist/meta.cjs.json +24 -34
- package/dist/meta.esbuild.json +35 -45
- package/package.json +6 -6
- package/src/Prebuilt/App.tsx +0 -1
- package/src/Prebuilt/components/AppData/AppData.tsx +16 -12
- package/src/Prebuilt/components/Chat/ChatSelector.tsx +4 -1
- package/src/Prebuilt/components/Connection/ConnectionIndicator.tsx +3 -2
- package/src/Prebuilt/components/Footer/ParticipantList.tsx +1 -1
- package/src/Prebuilt/components/Footer/WhiteboardToggle.tsx +4 -7
- package/src/Prebuilt/components/hooks/useCloseScreenshareWhiteboard.tsx +7 -22
- package/dist/chunk-7O27GQEH.js.map +0 -7
- /package/dist/{HLSView-GF23J3TJ.js.map → HLSView-I6DCFRWE.js.map} +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
2
|
+
import { selectPeerScreenSharing, useHMSStore, useWhiteboard } from '@100mslive/react-sdk';
|
3
3
|
import { PencilDrawIcon } from '@100mslive/react-icons';
|
4
4
|
import { Tooltip } from '../../..';
|
5
5
|
// @ts-ignore: No implicit Any
|
@@ -9,9 +9,8 @@ import { ToastManager } from '../Toast/ToastManager';
|
|
9
9
|
|
10
10
|
export const WhiteboardToggle = () => {
|
11
11
|
const { toggle, open, isOwner } = useWhiteboard();
|
12
|
-
const
|
13
|
-
const
|
14
|
-
const disabled = remoteScreenShare || (open && !isOwner);
|
12
|
+
const peerSharing = useHMSStore(selectPeerScreenSharing);
|
13
|
+
const disabled = !!peerSharing || (open && !isOwner);
|
15
14
|
|
16
15
|
if (!toggle) {
|
17
16
|
return null;
|
@@ -21,9 +20,7 @@ export const WhiteboardToggle = () => {
|
|
21
20
|
<Tooltip
|
22
21
|
key="whiteboard"
|
23
22
|
title={
|
24
|
-
|
25
|
-
? 'Cannot open whiteboard when viewing a shared screen'
|
26
|
-
: `${open ? 'Close' : 'Open'} Whiteboard`
|
23
|
+
peerSharing ? 'Cannot open whiteboard when viewing a shared screen' : `${open ? 'Close' : 'Open'} Whiteboard`
|
27
24
|
}
|
28
25
|
>
|
29
26
|
<IconButton
|
@@ -1,32 +1,17 @@
|
|
1
1
|
import { useEffect } from 'react';
|
2
|
-
import {
|
3
|
-
import { useScreenShare, useWhiteboard } from '@100mslive/react-sdk';
|
2
|
+
import { selectPeerScreenSharing, useHMSStore, useWhiteboard } from '@100mslive/react-sdk';
|
4
3
|
|
5
4
|
/**
|
6
|
-
* close existing
|
5
|
+
* close existing whiteboard when a screen is shared
|
7
6
|
*/
|
8
7
|
export const useCloseScreenshareWhiteboard = () => {
|
9
|
-
const
|
8
|
+
const peerSharing = useHMSStore(selectPeerScreenSharing);
|
10
9
|
const { isOwner: isWhiteboardOwner, toggle: toggleWhiteboard } = useWhiteboard();
|
11
|
-
const prevScreenSharer = usePrevious(screenSharingPeerId);
|
12
|
-
const prevWhiteboardOwner = usePrevious(isWhiteboardOwner);
|
13
10
|
|
14
|
-
// if both screenshare and whiteboard are open, close the
|
11
|
+
// if both screenshare and whiteboard are open, close the whiteboard
|
15
12
|
useEffect(() => {
|
16
|
-
if (isWhiteboardOwner &&
|
17
|
-
|
18
|
-
toggleScreenShare?.();
|
19
|
-
} else if (prevWhiteboardOwner && !prevScreenSharer) {
|
20
|
-
toggleWhiteboard?.();
|
21
|
-
}
|
13
|
+
if (isWhiteboardOwner && peerSharing) {
|
14
|
+
toggleWhiteboard?.();
|
22
15
|
}
|
23
|
-
}, [
|
24
|
-
isWhiteboardOwner,
|
25
|
-
screenSharingPeerId,
|
26
|
-
amIScreenSharing,
|
27
|
-
prevScreenSharer,
|
28
|
-
prevWhiteboardOwner,
|
29
|
-
toggleScreenShare,
|
30
|
-
toggleWhiteboard,
|
31
|
-
]);
|
16
|
+
}, [isWhiteboardOwner, toggleWhiteboard, peerSharing]);
|
32
17
|
};
|