diff --git a/packages/roomkit-react/src/Prebuilt/components/MoreSettings/ActionTile.jsx b/packages/roomkit-react/src/Prebuilt/components/MoreSettings/ActionTile.jsx index 962ac2b85a..10a3004515 100644 --- a/packages/roomkit-react/src/Prebuilt/components/MoreSettings/ActionTile.jsx +++ b/packages/roomkit-react/src/Prebuilt/components/MoreSettings/ActionTile.jsx @@ -1,33 +1,55 @@ import React from 'react'; import { Flex } from '../../../Layout'; import { Text } from '../../../Text'; +import { styled } from '../../../Theme'; -export const ActionTile = ({ icon, title, active, onClick, disabled = false, setOpenOptionsSheet }) => { - return ( - { - if (!disabled) { - onClick(); - setOpenOptionsSheet(false); - } - }} - css={{ - p: '$4 $2', - bg: active ? '$surface_bright' : '', - color: disabled ? '$on_surface_low' : '$on_surface_high', - gap: '$4', - r: '$1', - '&:hover': { - bg: '$surface_bright', - }, - }} - > - {icon} - - {title} - - - ); +const ActionTileRoot = ({ active, disabled = false, children, onClick, ...props }) => ( + { + if (!disabled) { + onClick(); + } + }} + > + {children} + +); + +const ActionTileCount = styled(Text, { + position: 'absolute', + top: 0, + right: 0, + fontWeight: '$semiBold', + color: '$on_surface_high', + p: '$1 $2', + bg: '$surface_bright', + r: '$round', + fontSize: '$tiny !important', +}); + +const ActionTileTitle = styled(Text, { + fontWeight: '$semiBold', + color: 'inherit', + textAlign: 'center', + fontSize: '$xs !important', +}); + +export const ActionTile = { + Root: ActionTileRoot, + Title: ActionTileTitle, + Count: ActionTileCount, }; diff --git a/packages/roomkit-react/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.jsx b/packages/roomkit-react/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.jsx index 23c531da37..98af8d2cb0 100644 --- a/packages/roomkit-react/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.jsx +++ b/packages/roomkit-react/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.jsx @@ -3,6 +3,7 @@ import { useClickAway } from 'react-use'; import { selectIsConnectedToRoom, selectIsLocalVideoEnabled, + selectPeerCount, selectPermissions, useHMSActions, useHMSStore, @@ -15,6 +16,7 @@ import { EmojiIcon, HandIcon, PencilIcon, + PeopleIcon, RecordIcon, SettingsIcon, } from '@100mslive/react-icons'; @@ -28,10 +30,12 @@ import { ToastManager } from '../../Toast/ToastManager'; import { ActionTile } from '.././ActionTile'; import { ChangeNameModal } from '.././ChangeNameModal'; import { MuteAllModal } from '.././MuteAllModal'; +import { useSidepaneToggle } from '../../AppData/useSidepane'; import { useDropdownList } from '../../hooks/useDropdownList'; import { useIsFeatureEnabled } from '../../hooks/useFeatures'; import { useMyMetadata } from '../../hooks/useMetadata'; -import { FEATURE_LIST } from '../../../common/constants'; +import { getFormattedCount } from '../../../common/utils'; +import { FEATURE_LIST, SIDE_PANE_OPTIONS } from '../../../common/constants'; const VirtualBackground = React.lazy(() => import('../../../plugins/VirtualBackground/VirtualBackground')); @@ -62,6 +66,8 @@ export const MwebOptions = () => { const [openSettingsSheet, setOpenSettingsSheet] = useState(false); const [showEmojiCard, setShowEmojiCard] = useState(false); const [showRecordingOn, setShowRecordingOn] = useState(false); + const toggleParticipants = useSidepaneToggle(SIDE_PANE_OPTIONS.PARTICIPANTS); + const peerCount = useHMSStore(selectPeerCount); const emojiCardRef = useRef(null); const isVideoOn = useHMSStore(selectIsLocalVideoEnabled); @@ -125,53 +131,82 @@ export const MwebOptions = () => { px: '$9', }} > + { + toggleParticipants(); + setOpenOptionsSheet(false); + }} + > + {getFormattedCount(peerCount)} + + Participants + + {isHandRaiseEnabled ? ( - } - onClick={toggleHandRaise} + + onClick={() => { + toggleHandRaise(); + setOpenOptionsSheet(false); + }} + > + + Raise Hand + ) : null} + {isBRBEnabled ? ( - } - onClick={toggleBRB} + + onClick={() => { + toggleBRB(); + setOpenOptionsSheet(false); + }} + > + + Be Right Back + ) : null} - } - onClick={() => updateState(MODALS.CHANGE_NAME, true)} - setOpenOptionsSheet={setOpenOptionsSheet} - /> + + { + updateState(MODALS.CHANGE_NAME, true); + setOpenOptionsSheet(false); + }} + > + + Change Name + + {isVideoOn ? ( setOpenOptionsSheet(false)} /> ) : null} - } - onClick={() => setShowEmojiCard(true)} - setOpenOptionsSheet={setOpenOptionsSheet} - /> - } - onClick={() => setOpenSettingsSheet(true)} - setOpenOptionsSheet={setOpenOptionsSheet} - /> - {isConnected && permissions?.browserRecording && ( - { + setShowEmojiCard(true); + setOpenOptionsSheet(false); + }} + > + + Emoji Reactions + + + { + setOpenSettingsSheet(true); + setOpenOptionsSheet(false); + }} + > + + Settings + + + {isConnected && permissions?.browserRecording ? ( + } onClick={async () => { if (isBrowserRecordingOn || isStreamingOn) { setShowRecordingOn(true); @@ -196,10 +231,15 @@ export const MwebOptions = () => { } } } + if (isHLSRunning) { + setOpenOptionsSheet(false); + } }} - setOpenOptionsSheet={setOpenOptionsSheet} - /> - )} + > + + {isBrowserRecordingOn ? 'Recording On' : 'Start Recording'} + + ) : null} diff --git a/packages/roomkit-react/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx b/packages/roomkit-react/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx index cc74627d46..ea147e7ebc 100644 --- a/packages/roomkit-react/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +++ b/packages/roomkit-react/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx @@ -77,18 +77,19 @@ export const VirtualBackground = ({ } if (asActionTile) { return ( - } + { setIsVBOn(!isVBOn); !isVBPresent ? addPlugin() : removePlugin(); onVBClick(); }} - active={isVBPresent} - disabled={isVBLoading} - data-testid="virtual_bg_btn" - /> + > + + Virtual Background + ); }