✨(frontend) introduce a custom placeholder
Based on Gmeet and Jitsi UI, display the Avatar component as placeholder.
This commit is contained in:
committed by
aleb_the_flash
parent
b554a6a542
commit
b3ef57e1b6
@@ -2,7 +2,7 @@ import { css } from '@/styled-system/css'
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
export type AvatarProps = React.HTMLAttributes<HTMLSpanElement> & {
|
export type AvatarProps = React.HTMLAttributes<HTMLSpanElement> & {
|
||||||
name: string
|
name?: string
|
||||||
size?: number
|
size?: number
|
||||||
bgColor?: string
|
bgColor?: string
|
||||||
textColor?: string
|
textColor?: string
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { Participant } from 'livekit-client'
|
||||||
|
import { styled } from '@/styled-system/jsx'
|
||||||
|
import { Avatar } from '@/components/Avatar'
|
||||||
|
|
||||||
|
const StyledParticipantPlaceHolder = styled('div', {
|
||||||
|
base: {
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
backgroundColor: '#3d4043', // fixme - copied from gmeet
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
type ParticipantPlaceholderProps = {
|
||||||
|
participant: Participant
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ParticipantPlaceholder = ({
|
||||||
|
participant,
|
||||||
|
}: ParticipantPlaceholderProps) => {
|
||||||
|
return (
|
||||||
|
<StyledParticipantPlaceHolder>
|
||||||
|
<Avatar name={participant.name} />
|
||||||
|
</StyledParticipantPlaceHolder>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
FocusToggle,
|
FocusToggle,
|
||||||
LockLockedIcon,
|
LockLockedIcon,
|
||||||
ParticipantName,
|
ParticipantName,
|
||||||
ParticipantPlaceholder,
|
|
||||||
ParticipantTileProps,
|
ParticipantTileProps,
|
||||||
ScreenShareIcon,
|
ScreenShareIcon,
|
||||||
TrackMutedIndicator,
|
TrackMutedIndicator,
|
||||||
@@ -25,6 +24,7 @@ import {
|
|||||||
TrackReferenceOrPlaceholder,
|
TrackReferenceOrPlaceholder,
|
||||||
} from '@livekit/components-core'
|
} from '@livekit/components-core'
|
||||||
import { Track } from 'livekit-client'
|
import { Track } from 'livekit-client'
|
||||||
|
import { ParticipantPlaceholder } from '@/features/rooms/livekit/components/ParticipantPlaceholder'
|
||||||
|
|
||||||
export function TrackRefContextIfNeeded(
|
export function TrackRefContextIfNeeded(
|
||||||
props: React.PropsWithChildren<{
|
props: React.PropsWithChildren<{
|
||||||
@@ -108,7 +108,9 @@ export const ParticipantTile: (
|
|||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
<div className="lk-participant-placeholder">
|
<div className="lk-participant-placeholder">
|
||||||
<ParticipantPlaceholder />
|
<ParticipantPlaceholder
|
||||||
|
participant={trackReference.participant}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="lk-participant-metadata">
|
<div className="lk-participant-metadata">
|
||||||
<div className="lk-participant-metadata-item">
|
<div className="lk-participant-metadata-item">
|
||||||
|
|||||||
Reference in New Issue
Block a user