Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tile ui issues #1634

Merged
merged 5 commits into from
Aug 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
import React from 'react';
import { styled, Text, textEllipsis } from '../../../';
import { PinIcon, SpotlightIcon } from '@100mslive/react-icons';
import { Flex, styled, Text, textEllipsis } from '../../../';
import { ConnectionIndicator } from './ConnectionIndicator';

const TileConnection = ({ name, peerId, hideLabel, width }) => {
const TileConnection = ({ name, peerId, hideLabel, width, spotlighted, pinned }) => {
return (
<Wrapper>
{!hideLabel ? (
<Text
css={{
c: '$on_surface_high',
...textEllipsis(width - 60),
}}
variant="xs"
>
{name}
</Text>
<Flex align="center">
{pinned && (
<IconWrapper>
<PinIcon width="15" height="15" css={{ display: 'block' }} />
</IconWrapper>
)}
{spotlighted && (
<IconWrapper>
<SpotlightIcon width="15" height="15" css={{ display: 'block' }} />
</IconWrapper>
)}
<Text
css={{
c: '$on_surface_high',
verticalAlign: 'baseline',
...textEllipsis(width - 60),
}}
variant="xs"
>
{name}
</Text>
</Flex>
) : null}
<ConnectionIndicator isTile peerId={peerId} />
</Wrapper>
);
};

const IconWrapper = styled('div', { c: '$on_surface_high', ml: '$3', mt: '$1' });

const Wrapper = styled('div', {
display: 'flex',
alignItems: 'center',
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@ const TileMenu = ({ audioTrackID, videoTrackID, peerID, isScreenshare = false, c

{isMobile ? (
<Sheet.Root open={open} onOpenChange={setOpen}>
<Sheet.Content css={{ bg: '$surface_dim', pt: '$8' }}>
<Sheet.Content css={{ bg: '$surface_dim', pt: '$8', border: '1px solid $border_bright' }}>
<Flex
css={{
color: '$on_surface_high',
@@ -114,12 +114,14 @@ const TileMenu = ({ audioTrackID, videoTrackID, peerID, isScreenshare = false, c
</Sheet.Content>
</Sheet.Root>
) : (
<StyledMenuTile.Content side="top" align="end">
<StyledMenuTile.Content side="top" align="end" css={{ border: '1px solid $border_bright' }}>
<TileMenuContent {...props} />
</StyledMenuTile.Content>
)}
</StyledMenuTile.Root>
);
};

export { isSameTile } from './TileMenuContent';

export default TileMenu;
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ import { useSetAppDataByKey } from '../AppData/useUISettings';
import { useDropdownSelection } from '../hooks/useDropdownSelection';
import { APP_DATA, REMOTE_STOP_SCREENSHARE_TYPE, SESSION_STORE_KEY } from '../../common/constants';

const isSameTile = ({ trackId, videoTrackID, audioTrackID }) =>
export const isSameTile = ({ trackId, videoTrackID, audioTrackID }) =>
trackId && ((videoTrackID && videoTrackID === trackId) || (audioTrackID && audioTrackID === trackId));

const spacingCSS = { '@md': { my: '$8', fontWeight: '$semiBold', fontSize: 'sm' } };
29 changes: 23 additions & 6 deletions packages/roomkit-react/src/Prebuilt/components/VideoTile.jsx
Original file line number Diff line number Diff line change
@@ -5,22 +5,23 @@ import {
selectLocalPeerID,
selectPeerMetadata,
selectPeerNameByID,
selectSessionStore,
selectVideoTrackByID,
selectVideoTrackByPeerID,
useHMSStore,
} from '@100mslive/react-sdk';
import { BrbTileIcon, HandIcon, MicOffIcon } from '@100mslive/react-icons';
import TileConnection from './Connection/TileConnection';
import TileMenu from './TileMenu/TileMenu';
import TileMenu, { isSameTile } from './TileMenu/TileMenu';
import { useBorderAudioLevel } from '../../AudioLevel';
import { Avatar } from '../../Avatar';
import { VideoTileStats } from '../../Stats';
import { Video } from '../../Video';
import { StyledVideoTile } from '../../VideoTile';
import { getVideoTileLabel } from './peerTileUtils';
import { useAppConfig } from './AppData/useAppConfig';
import { useIsHeadless, useUISettings } from './AppData/useUISettings';
import { UI_SETTINGS } from '../common/constants';
import { useIsHeadless, useSetAppDataByKey, useUISettings } from './AppData/useUISettings';
import { APP_DATA, SESSION_STORE_KEY, UI_SETTINGS } from '../common/constants';

const Tile = ({
peerId,
@@ -47,6 +48,13 @@ const Tile = ({
const borderAudioRef = useBorderAudioLevel(audioTrack?.id);
const isVideoDegraded = track?.degraded;
const isLocal = localPeerID === peerId;
const [pinnedTrackId] = useSetAppDataByKey(APP_DATA.pinnedTrackId);
const pinned = isSameTile({
trackId: pinnedTrackId,
videoTrackID: track?.id,
audioTrackID: audioTrack?.id,
});
const spotlighted = useHMSStore(selectSessionStore(SESSION_STORE_KEY.SPOTLIGHT)) === peerId;
const label = getVideoTileLabel({
peerName,
track,
@@ -106,15 +114,16 @@ const Tile = ({
track?.source === 'regular' &&
track?.facingMode !== 'environment'
}
degraded={isVideoDegraded}
noRadius={isHeadless && Number(headlessConfig?.tileOffset) === 0}
data-testid="participant_video_tile"
css={{
objectFit,
filter: isVideoDegraded ? 'blur($space$4)' : undefined,
bg: 'transparent',
}}
/>
) : null}
{isVideoMuted || isVideoDegraded || (!isLocal && isAudioOnly) ? (
{isVideoMuted || (!isLocal && isAudioOnly) ? (
<StyledVideoTile.AvatarContainer>
<Avatar name={peerName || ''} data-testid="participant_avatar_icon" size={avatarSize} />
</StyledVideoTile.AvatarContainer>
@@ -141,7 +150,15 @@ const Tile = ({
/>
) : null}
<PeerMetadata peerId={peerId} />
<TileConnection hideLabel={hideLabel} name={label} isTile peerId={peerId} width={width} />
<TileConnection
hideLabel={hideLabel}
name={label}
isTile
peerId={peerId}
width={width}
pinned={pinned}
spotlighted={spotlighted}
/>
</StyledVideoTile.Container>
) : null}
</StyledVideoTile.Root>
Original file line number Diff line number Diff line change
@@ -22,6 +22,6 @@ export const getVideoTileLabel = ({ peerName, isLocal, track }) => {
} else {
label = `${peerName} ${track.source}`;
}
label = `${label}${track.degraded ? '(Degraded)' : ''}`;
// label = `${label}${track.degraded ? '(Degraded)' : ''}`;
return `${label}${isLocallyMuted ? ' (Muted for you)' : ''}`;
};
1 change: 1 addition & 0 deletions packages/roomkit-react/src/Prebuilt/layouts/InsetView.jsx
Original file line number Diff line number Diff line change
@@ -234,6 +234,7 @@ export const InsetTile = () => {
}}
width={width}
height={height}
containerCSS={{ background: '$surface_default' }}
canMinimise
/>
)}