diff --git a/src/frontend/src/features/participantTile/components/ParticipantMetadata.tsx b/src/frontend/src/features/participantTile/components/ParticipantMetadata.tsx new file mode 100644 index 00000000..44555dee --- /dev/null +++ b/src/frontend/src/features/participantTile/components/ParticipantMetadata.tsx @@ -0,0 +1,95 @@ +import { + useRaisedHand, + useRaisedHandPosition, +} from '@/features/rooms/livekit/hooks/useRaisedHand' +import { + ConnectionQualityIndicator, + LockLockedIcon, + ScreenShareIcon, + useIsEncrypted, + useParticipantInfo, +} from '@livekit/components-react' +import { HStack } from '@/styled-system/jsx' +import { Participant } from 'livekit-client' +import { MutedMicIndicator } from './MutedMicIndicator' +import { RiHand } from '@remixicon/react' +import { ParticipantName } from './ParticipantName' + +export const ParticipantMetadata = ({ + participant, + isScreenShare, +}: { + participant: Participant + isScreenShare: boolean +}) => { + const { identity, name } = useParticipantInfo({ participant }) + const isEncrypted = useIsEncrypted(participant) + const { isHandRaised } = useRaisedHand({ participant }) + const { positionInQueue, firstInQueue } = useRaisedHandPosition({ + participant, + }) + + return ( +
+ + {!isScreenShare && } +
+ {isHandRaised && !isScreenShare && ( + + {positionInQueue} + + + )} + {isScreenShare && ( + + )} + {isEncrypted && !isScreenShare && ( + + )} +
+ +
+
+
+ +
+ ) +} diff --git a/src/frontend/src/features/participantTile/components/ParticipantTile.tsx b/src/frontend/src/features/participantTile/components/ParticipantTile.tsx index c5a0e70b..7902e758 100644 --- a/src/frontend/src/features/participantTile/components/ParticipantTile.tsx +++ b/src/frontend/src/features/participantTile/components/ParticipantTile.tsx @@ -1,18 +1,13 @@ import { AudioTrack, - ConnectionQualityIndicator, - LockLockedIcon, ParticipantTileProps, - ScreenShareIcon, useEnsureTrackRef, useFeatureContext, - useIsEncrypted, useMaybeTrackRefContext, useParticipantTile, VideoTrack, TrackRefContext, ParticipantContextIfNeeded, - useParticipantInfo, } from '@livekit/components-react' import React from 'react' import { @@ -21,23 +16,16 @@ import { TrackReferenceOrPlaceholder, } from '@livekit/components-core' import { Track } from 'livekit-client' -import { RiHand } from '@remixicon/react' -import { - useRaisedHand, - useRaisedHandPosition, -} from '@/features/rooms/livekit/hooks/useRaisedHand' -import { HStack } from '@/styled-system/jsx' -import { MutedMicIndicator } from './MutedMicIndicator' import { ParticipantPlaceholder } from './ParticipantPlaceholder' import { ParticipantTileFocus } from './ParticipantTileFocus' import { FullScreenShareWarning } from './FullScreenShareWarning' -import { ParticipantName } from './ParticipantName' import { getParticipantName } from '@/features/rooms/utils/getParticipantName' import { useTranslation } from 'react-i18next' import { getShortcutDescriptorById } from '@/features/shortcuts/catalog' import { formatShortcutLabel } from '@/features/shortcuts/formatLabels' import { KeyboardShortcutHint } from './KeyboardShortcutHint' import { layoutStore, clearPinnedTrack } from '@/stores/layout' +import { ParticipantMetadata } from './ParticipantMetadata' export function TrackRefContextIfNeeded( props: React.PropsWithChildren<{ @@ -77,18 +65,12 @@ export const ParticipantTile: ( ref ) { const trackReference = useEnsureTrackRef(trackRef) - - const { identity, name } = useParticipantInfo({ - participant: trackReference.participant, - }) - const { elementProps } = useParticipantTile({ htmlProps, disableSpeakingIndicator, onParticipantClick, trackRef: trackReference, }) - const isEncrypted = useIsEncrypted(trackReference.participant) const autoManageSubscription = useFeatureContext()?.autoSubscription const handleSubscribe = React.useCallback( @@ -105,14 +87,6 @@ export const ParticipantTile: ( [trackReference] ) - const { isHandRaised } = useRaisedHand({ - participant: trackReference.participant, - }) - - const { positionInQueue, firstInQueue } = useRaisedHandPosition({ - participant: trackReference.participant, - }) - const isScreenShare = trackReference.source != Track.Source.Camera const [hasKeyboardFocus, setHasKeyboardFocus] = React.useState(false) @@ -169,72 +143,10 @@ export const ParticipantTile: ( /> {!disableMetadata && ( -
- - {!isScreenShare && ( - - )} -
- {isHandRaised && !isScreenShare && ( - - {positionInQueue} - - - )} - {isScreenShare && ( - - )} - {isEncrypted && !isScreenShare && ( - - )} -
- -
-
-
- -
+ )} )}