fix(participants-pane): Use selector for displaying names
This commit is contained in:
parent
91197bc69f
commit
d69d4dd91a
|
@ -185,6 +185,17 @@ export function getParticipantDisplayName(
|
||||||
: 'Fellow Jitster';
|
: 'Fellow Jitster';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Curried version of getParticipantDisplayName.
|
||||||
|
*
|
||||||
|
* @see {@link getParticipantDisplayName}
|
||||||
|
* @param {string} id - The ID of the participant's display name to retrieve.
|
||||||
|
* @returns {Function}
|
||||||
|
*/
|
||||||
|
export const getParticipantDisplayNameWithId = (id: string) =>
|
||||||
|
(state: Object | Function) =>
|
||||||
|
getParticipantDisplayName(state, id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the presence status of a participant associated with the passed id.
|
* Returns the presence status of a participant associated with the passed id.
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import React, { type Node } from 'react';
|
import React, { type Node } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
|
||||||
import { Avatar } from '../../base/avatar';
|
import { Avatar } from '../../base/avatar';
|
||||||
import {
|
import {
|
||||||
|
@ -11,6 +12,7 @@ import {
|
||||||
IconMicrophoneEmpty,
|
IconMicrophoneEmpty,
|
||||||
IconMicrophoneEmptySlash
|
IconMicrophoneEmptySlash
|
||||||
} from '../../base/icons';
|
} from '../../base/icons';
|
||||||
|
import { getParticipantDisplayNameWithId } from '../../base/participants';
|
||||||
import { ActionTrigger, MediaState } from '../constants';
|
import { ActionTrigger, MediaState } from '../constants';
|
||||||
|
|
||||||
import { RaisedHandIndicator } from './RaisedHandIndicator';
|
import { RaisedHandIndicator } from './RaisedHandIndicator';
|
||||||
|
@ -125,6 +127,7 @@ export const ParticipantItem = ({
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const ParticipantActions = Actions[actionsTrigger];
|
const ParticipantActions = Actions[actionsTrigger];
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const name = useSelector(getParticipantDisplayNameWithId(p.id));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ParticipantContainer
|
<ParticipantContainer
|
||||||
|
@ -138,7 +141,7 @@ export const ParticipantItem = ({
|
||||||
<ParticipantContent>
|
<ParticipantContent>
|
||||||
<ParticipantNameContainer>
|
<ParticipantNameContainer>
|
||||||
<ParticipantName>
|
<ParticipantName>
|
||||||
{ p.name }
|
{ name }
|
||||||
</ParticipantName>
|
</ParticipantName>
|
||||||
{ p.local ? <span> ({t('chat.you')})</span> : null }
|
{ p.local ? <span> ({t('chat.you')})</span> : null }
|
||||||
</ParticipantNameContainer>
|
</ParticipantNameContainer>
|
||||||
|
|
Loading…
Reference in New Issue