diff --git a/src/frontend/src/components/Avatar.tsx b/src/frontend/src/components/Avatar.tsx index 326d1e62..6f0af42f 100644 --- a/src/frontend/src/components/Avatar.tsx +++ b/src/frontend/src/components/Avatar.tsx @@ -11,14 +11,14 @@ export type AvatarProps = React.HTMLAttributes & { export const Avatar = ({ name, size = 32, - bgColor = '#3498db', + bgColor, textColor = 'white', }: AvatarProps) => { const initial = name?.trim()?.charAt(0).toUpperCase() || '' return (
{initial} diff --git a/src/frontend/src/features/rooms/livekit/components/ParticipantPlaceholder.tsx b/src/frontend/src/features/rooms/livekit/components/ParticipantPlaceholder.tsx index 8b64eed1..07f51301 100644 --- a/src/frontend/src/features/rooms/livekit/components/ParticipantPlaceholder.tsx +++ b/src/frontend/src/features/rooms/livekit/components/ParticipantPlaceholder.tsx @@ -2,6 +2,7 @@ import { Participant } from 'livekit-client' import { styled } from '@/styled-system/jsx' import { Avatar } from '@/components/Avatar' import { useIsSpeaking } from '@livekit/components-react' +import { getParticipantColor } from '@/features/rooms/utils/getParticipantColor' const StyledParticipantPlaceHolder = styled('div', { base: { @@ -22,7 +23,7 @@ export const ParticipantPlaceholder = ({ participant, }: ParticipantPlaceholderProps) => { const isSpeaking = useIsSpeaking(participant) - + const participantColor = getParticipantColor(participant) return (
- +
) diff --git a/src/frontend/src/features/rooms/livekit/components/controls/Participants/ParticipantsList.tsx b/src/frontend/src/features/rooms/livekit/components/controls/Participants/ParticipantsList.tsx index 541a02d5..0fe88848 100644 --- a/src/frontend/src/features/rooms/livekit/components/controls/Participants/ParticipantsList.tsx +++ b/src/frontend/src/features/rooms/livekit/components/controls/Participants/ParticipantsList.tsx @@ -11,6 +11,7 @@ import { participantsStore } from '@/stores/participants' import { useTranslation } from 'react-i18next' import { allParticipantRoomEvents } from '@/features/rooms/livekit/constants/events' import { Avatar } from '@/components/Avatar' +import { getParticipantColor } from '@/features/rooms/utils/getParticipantColor' // TODO: Optimize rendering performance, especially for longer participant lists, even though they are generally short. export const ParticipantsList = () => { @@ -26,6 +27,7 @@ export const ParticipantsList = () => { const formattedParticipants = participants.map((participant) => ({ name: participant.name || participant.identity, id: participant.identity, + color: getParticipantColor(participant), })) const sortedRemoteParticipants = formattedParticipants @@ -94,7 +96,7 @@ export const ParticipantsList = () => { padding: '0.25rem 0', })} > - + { + const { metadata } = participant + if (!metadata) { + return + } + return JSON.parse(metadata)['color'] +}