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 { config as cssConfig, Footer as AppFooter } from '../../..'; // @ts-ignore: No implicit Any import { AudioVideoToggle } from '../AudioVideoToggle'; import { CaptionIcon } from '../CaptionIcon'; // @ts-ignore: No implicit Any import { EmojiReaction } from '../EmojiReaction'; // @ts-ignore: No implicit Any import { LeaveRoom } from '../Leave/LeaveRoom'; // @ts-ignore: No implicit Any import { MoreSettings } from '../MoreSettings/MoreSettings'; import { RaiseHand } from '../RaiseHand'; // @ts-ignore: No implicit Any import { ScreenshareToggle } from '../ScreenShareToggle'; // @ts-ignore: No implicit Any import { VBToggle } from '../VirtualBackground/VBToggle'; // @ts-ignore: No implicit Any import { ChatToggle } from './ChatToggle'; import { ParticipantCount } from './ParticipantList'; import { PollsToggle } from './PollsToggle'; import { WhiteboardToggle } from './WhiteboardToggle'; import { ConferencingScreenElements } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen'; // @ts-ignore: No implicit Any import { useIsSidepaneTypeOpen, useSidepaneToggle } from '../AppData/useSidepane'; // @ts-ignore: No implicit Any import { useShowPolls } from '../AppData/useUISettings'; // @ts-ignore: No implicit Any import { SIDE_PANE_OPTIONS } from '../../common/constants'; export const Footer = ({ screenType, elements, }: { screenType: keyof ConferencingScreen; elements: ConferencingScreenElements; }) => { const isMobile = useMedia(cssConfig.media.md); const isOverlayChat = !!elements?.chat?.is_overlay; const openByDefault = elements?.chat?.initial_state === Chat_ChatState.CHAT_STATE_OPEN; const isChatOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.CHAT); const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT); const { showPolls } = useShowPolls(); useEffect(() => { if (!isChatOpen && openByDefault) { toggleChat(); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [toggleChat, openByDefault]); return ( {isMobile ? : null} {!isMobile && elements.virtual_background ? : null} {isMobile ? ( <> {elements?.chat && } ) : ( <> {screenType !== 'hls_live_streaming' && } {elements?.emoji_reactions && } )} {showPolls && } {!isMobile && elements?.chat && } {elements?.participant_list && } ); };