import React from 'react'; import { HMSPeerType, selectPeerTypeByID, selectScreenShareByPeerID, selectSessionStore, useHMSStore, } from '@100mslive/react-sdk'; import { CallIcon, PinIcon, ShareScreenIcon, SpotlightIcon } from '@100mslive/react-icons'; import { Flex, styled, Text, textEllipsis } from '../../..'; import { ConnectionIndicator } from './ConnectionIndicator'; import { SESSION_STORE_KEY } from '../../common/constants'; const TileConnection = ({ name, peerId, hideLabel, width, pinned, }: { name: string; peerId: string; hideLabel: boolean; width?: string | number; pinned?: boolean; }) => { const spotlighted = useHMSStore(selectSessionStore(SESSION_STORE_KEY.SPOTLIGHT)) === peerId; const isPeerScreenSharing = !!useHMSStore(selectScreenShareByPeerID(peerId)); const peerType = useHMSStore(selectPeerTypeByID(peerId)); return ( {!hideLabel ? ( <> {name ? ( {peerType === HMSPeerType.SIP && ( )} {isPeerScreenSharing && ( )} {pinned && ( )} {spotlighted && ( )} {name} ) : null} ) : null} ); }; const IconWrapper = styled('div', { c: '$on_surface_high', ml: '$3', mt: '$1', display: 'flex' }); const Wrapper = styled('div', { display: 'flex', alignItems: 'center', justifyContent: 'space-between', position: 'absolute', bottom: '$2', left: '$2', backgroundColor: '$background_dim', borderRadius: '$1', maxWidth: '85%', zIndex: 1, '& p,span': { p: '$2 $3', }, }); export default TileConnection;