Skip to content

Commit

Permalink
fix: conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhKumar05 committed Mar 19, 2024
2 parents 23e3bf9 + fdcb4d2 commit 67f5def
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 66 deletions.
2 changes: 1 addition & 1 deletion packages/roomkit-react/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions packages/roomkit-react/src/Accordion/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ export const AccordionRoot = StyledAccordion;
export const AccordionItem = StyledItem;

export const AccordionHeader: React.FC<
PropsWithChildren<BaseAccordion.AccordionTriggerProps & { iconStyles?: CSS; css?: CSS }>
PropsWithChildren<BaseAccordion.AccordionTriggerProps & { iconStyles?: CSS; css?: CSS; chevronID?: string }>
> = React.forwardRef<
HTMLButtonElement,
PropsWithChildren<BaseAccordion.AccordionTriggerProps & { iconStyles?: CSS; css?: CSS }>
>(({ children, iconStyles, css, ...props }, forwardedRef) => (
PropsWithChildren<BaseAccordion.AccordionTriggerProps & { iconStyles?: CSS; css?: CSS; chevronID?: string }>
>(({ children, iconStyles, css, chevronID, ...props }, forwardedRef) => (
<StyledHeader css={css}>
<StyledTrigger {...props} ref={forwardedRef}>
{children}
<StyledChevron aria-hidden css={iconStyles} />
<StyledChevron data-testid={chevronID} aria-hidden css={iconStyles} />
</StyledTrigger>
</StyledHeader>
));
Expand Down
10 changes: 10 additions & 0 deletions packages/roomkit-react/src/Prebuilt/components/Chat/ChatBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ export const ChatBody = React.forwardRef<VariableSizeList, { scrollToBottom: (co
}, [blacklistedMessageIDs, messages]);

const vanillaStore = useHMSVanillaStore();
const rerenderOnFirstMount = useRef(false);

useEffect(() => {
const unsubscribe = vanillaStore.subscribe(() => {
Expand All @@ -426,6 +427,15 @@ export const ChatBody = React.forwardRef<VariableSizeList, { scrollToBottom: (co
return unsubscribe;
}, [vanillaStore, listRef, scrollToBottom]);

useEffect(() => {
// @ts-ignore
if (filteredMessages.length > 0 && listRef?.current && !rerenderOnFirstMount.current) {
rerenderOnFirstMount.current = true;
// @ts-ignore
listRef.current.resetAfterIndex(0);
}
}, [listRef, filteredMessages]);

return filteredMessages.length === 0 ? (
<EmptyChat />
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'reac
import { useMedia } from 'react-use';
import data from '@emoji-mart/data';
import Picker from '@emoji-mart/react';
import { HMSException, selectLocalPeer, useAVToggle, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
import { HMSException, selectLocalPeer, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
import { EmojiIcon, PauseCircleIcon, SendIcon, VerticalMenuIcon } from '@100mslive/react-icons';
import { Box, config as cssConfig, Flex, IconButton as BaseIconButton, Popover, styled, Text } from '../../..';
import { IconButton } from '../../../IconButton';
Expand Down Expand Up @@ -89,8 +89,6 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo
const defaultSelection = useDefaultChatSelection();
const selection = selectedPeer.name || selectedRole || defaultSelection;
const isLocalPeerBlacklisted = useIsPeerBlacklisted({ local: true });
const { toggleAudio, toggleVideo } = useAVToggle();
const noAVPermissions = !(toggleAudio || toggleVideo);
const isMwebHLSStream = useMobileHLSStream();
const isLandscapeHLSStream = useLandscapeHLSStream();

Expand Down Expand Up @@ -275,7 +273,7 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo
}}
gap="2"
>
{noAVPermissions ? <RaiseHand css={{ bg: '$surface_default' }} /> : null}
<RaiseHand css={{ bg: '$surface_default' }} />
<MoreSettings elements={elements} screenType={screenType} />
</Flex>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
selectAppData,
selectIsConnectedToRoom,
selectRoomState,
useAVToggle,
useHMSActions,
useHMSStore,
} from '@100mslive/react-sdk';
Expand Down Expand Up @@ -54,8 +53,6 @@ export const ConferenceScreen = () => {
const dropdownListRef = useRef<string[]>();
const [isHLSStarted] = useSetAppDataByKey(APP_DATA.hlsStarted);

const { toggleAudio, toggleVideo } = useAVToggle();
const noAVPermissions = !(toggleAudio || toggleVideo);
// using it in hls stream to show action button when chat is disabled
const showChat = !!screenProps.elements?.chat;
const autoRoomJoined = useRef(isPreviewScreenEnabled);
Expand Down Expand Up @@ -202,7 +199,7 @@ export const ConferenceScreen = () => {
justify="end"
gap="2"
>
{noAVPermissions ? <RaiseHand /> : null}
<RaiseHand />
<MoreSettings elements={screenProps.elements} screenType={screenProps.screenType} />
<Box
css={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useEffect } from 'react';
import { useMedia } from 'react-use';
import { ConferencingScreen } from '@100mslive/types-prebuilt';
import { Chat_ChatState } from '@100mslive/types-prebuilt/elements/chat';
import { useAVToggle } from '@100mslive/react-sdk';
import { config as cssConfig, Footer as AppFooter } from '../../..';
// @ts-ignore: No implicit Any
import { AudioVideoToggle } from '../AudioVideoToggle';
Expand Down Expand Up @@ -41,8 +40,6 @@ export const Footer = ({
const isOverlayChat = !!elements?.chat?.is_overlay;
const openByDefault = elements?.chat?.initial_state === Chat_ChatState.CHAT_STATE_OPEN;

const { toggleAudio, toggleVideo } = useAVToggle();
const noAVPermissions = !(toggleAudio || toggleVideo);
const isChatOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.CHAT);
const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
const { showPolls } = useShowPolls();
Expand Down Expand Up @@ -90,7 +87,7 @@ export const Footer = ({
>
{isMobile ? (
<>
{noAVPermissions ? <RaiseHand /> : null}
<RaiseHand />
{elements?.chat && <ChatToggle />}
<MoreSettings elements={elements} screenType={screenType} />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export const RoleAccordion = ({
return (
<Accordion.Item value={roleName} css={{ '&:hover .role_actions': { visibility: 'visible' }, mb: '$8' }} ref={ref}>
<Accordion.Header
chevronID={`role_accordion_btn_${roleName}`}
iconStyles={{ c: '$on_surface_high' }}
css={{
textTransform: 'capitalize',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { FullScreenItem } from '../FullScreenItem';
import { MuteAllModal } from '../MuteAllModal';
// @ts-ignore: No implicit any
import { useDropdownList } from '../../hooks/useDropdownList';
// @ts-ignore: No implicit any
import { useMyMetadata } from '../../hooks/useMetadata';
// @ts-ignore: No implicit any
import { APP_DATA, isMacOS } from '../../../common/constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
selectIsConnectedToRoom,
selectPeerCount,
selectPermissions,
useAVToggle,
useHMSActions,
useHMSStore,
useRecordingStreaming,
Expand Down Expand Up @@ -51,7 +50,6 @@ import { usePollViewToggle, useSidepaneToggle } from '../../AppData/useSidepane'
import { useShowPolls } from '../../AppData/useUISettings';
// @ts-ignore: No implicit any
import { useDropdownList } from '../../hooks/useDropdownList';
// @ts-ignore: No implicit any
import { useMyMetadata } from '../../hooks/useMetadata';
import { useUnreadPollQuizPresent } from '../../hooks/useUnreadPollQuizPresent';
import { useLandscapeHLSStream, useMobileHLSStream } from '../../../common/hooks';
Expand Down Expand Up @@ -95,8 +93,6 @@ export const MwebOptions = ({
const peerCount = useHMSStore(selectPeerCount);
const emojiCardRef = useRef(null);
const { isBRBOn, toggleBRB, isHandRaised, toggleHandRaise } = useMyMetadata();
const { toggleAudio, toggleVideo } = useAVToggle();
const noAVPermissions = !(toggleAudio || toggleVideo);
const { unreadPollQuiz, setUnreadPollQuiz } = useUnreadPollQuizPresent();
const { title, description } = useRoomLayoutHeader();
const toggleDetailsSheet = useSheetToggle(SHEET_OPTIONS.ROOM_DETAILS);
Expand Down Expand Up @@ -175,7 +171,7 @@ export const MwebOptions = ({
</ActionTile.Root>
)}

{!noAVPermissions ? (
{elements.hand_raise ? (
<ActionTile.Root
active={isHandRaised}
onClick={() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useEffect } from 'react';
import { selectLocalPeerRoleName, useHMSVanillaStore } from '@100mslive/react-sdk';
// @ts-ignore: No implicit Any
import { useMyMetadata } from './hooks/useMetadata';

export const PreviousRoleInMetadata = () => {
Expand Down
8 changes: 7 additions & 1 deletion packages/roomkit-react/src/Prebuilt/components/RaiseHand.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ import { CSS } from '../../Theme';
import { Tooltip } from '../../Tooltip';
// @ts-ignore: No implicit Any
import IconButton from '../IconButton';
// @ts-ignore: No implicit Any
import { useRoomLayoutConferencingScreen } from '../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
import { useMyMetadata } from './hooks/useMetadata';

export const RaiseHand = ({ css }: { css?: CSS }) => {
const { isHandRaised, toggleHandRaise } = useMyMetadata();
const { elements } = useRoomLayoutConferencingScreen();

if (!elements.hand_raise) {
return null;
}

return (
<Tooltip title={isHandRaised ? 'Lower hand' : 'Raise hand'}>
<IconButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { Flex, Text } from '../../..';
import { PreviewControls, PreviewTile } from '../Preview/PreviewJoin';
import { RequestPrompt } from './RequestPrompt';
import { useRoomLayoutPreviewScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
// @ts-ignore: No implicit Any
import { useMyMetadata } from '../hooks/useMetadata';
// @ts-ignore: No implicit Any
import { ROLE_CHANGE_DECLINED } from '../../common/constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const useMyMetadata = () => {
const metaData = useHMSStore(selectPeerMetadata(localPeerId));
const isHandRaised = useHMSStore(selectHasPeerHandRaised(localPeerId));

const update = async updatedFields => {
const update = async (updatedFields: Record<string, any>) => {
try {
// get current state from store and merge updated fields
const currentMetadata = vanillaStore.getState(selectPeerMetadata(localPeerId));
Expand All @@ -24,6 +24,7 @@ export const useMyMetadata = () => {
} catch (error) {
console.error('failed to update metadata ', updatedFields);
}
return false;
};

const toggleHandRaise = useCallback(async () => {
Expand All @@ -43,19 +44,12 @@ export const useMyMetadata = () => {
}
}, [metaData?.isBRBOn]); //eslint-disable-line

const setPrevRole = async role => {
await update({
prevRole: role,
});
};

return {
isHandRaised,
isBRBOn: !!metaData?.isBRBOn,
metaData,
updateMetaData: update,
toggleHandRaise,
toggleBRB,
setPrevRole,
};
};
39 changes: 7 additions & 32 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
resolved "https://registry.yarnpkg.com/@100mslive/hms-noise-cancellation/-/hms-noise-cancellation-0.0.0-alpha.1.tgz#894adbbbc8da757228d98719d3fc17abe129b11f"
integrity sha512-GZpycuSW0uA73vbOJy7AKs6xc8U+ifzm9xIOEwtAA28VubeyaEP9LbaP7NWrUkqAmkGl9fRMuxQWoG3gKYek2Q==

"@100mslive/[email protected].7":
version "0.12.7"
resolved "https://registry.yarnpkg.com/@100mslive/types-prebuilt/-/types-prebuilt-0.12.7.tgz#66e26701964a8c7a0ab7df4787ac64ad8f8870f4"
integrity sha512-GsDJCZA74+wuBorERQbVA0isRUQduBZzkyzRfMhFA29ZDaVTManrnwamf9TrZvrFJRFTVhZ6lv05oUaauqJRjA==
"@100mslive/[email protected].8":
version "0.12.8"
resolved "https://registry.yarnpkg.com/@100mslive/types-prebuilt/-/types-prebuilt-0.12.8.tgz#2fe9007eb14e66ad3ba687313c4254e2ed085629"
integrity sha512-W1ISh3Mk8/wkomeFiBte7HZLk1gJocnN5U0N8rzZ9WFdDlAW7q/hKgnh+X1/9QxVcv3USfuZyKotbZ7AXmvCiQ==

"@aashutoshrathi/word-wrap@^1.2.3":
version "1.2.6"
Expand Down Expand Up @@ -15781,16 +15781,7 @@ string-natural-compare@^3.0.1:
resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4"
integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw==

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -15890,14 +15881,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -17194,7 +17178,7 @@ worker-timers@^7.0.40:
worker-timers-broker "^6.0.95"
worker-timers-worker "^7.0.59"

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -17212,15 +17196,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit 67f5def

Please sign in to comment.