Bläddra i källkod

fix(participants-pane): Use selector for displaying names

j8
Gabriel Imre 4 år sedan
förälder
incheckning
d69d4dd91a

+ 11
- 0
react/features/base/participants/functions.js Visa fil

185
         : 'Fellow Jitster';
185
         : 'Fellow Jitster';
186
 }
186
 }
187
 
187
 
188
+/**
189
+ * Curried version of getParticipantDisplayName.
190
+ *
191
+ * @see {@link getParticipantDisplayName}
192
+ * @param {string} id - The ID of the participant's display name to retrieve.
193
+ * @returns {Function}
194
+ */
195
+export const getParticipantDisplayNameWithId = (id: string) =>
196
+    (state: Object | Function) =>
197
+        getParticipantDisplayName(state, id);
198
+
188
 /**
199
 /**
189
  * Returns the presence status of a participant associated with the passed id.
200
  * Returns the presence status of a participant associated with the passed id.
190
  *
201
  *

+ 4
- 1
react/features/participants-pane/components/ParticipantItem.js Visa fil

2
 
2
 
3
 import React, { type Node } from 'react';
3
 import React, { type Node } from 'react';
4
 import { useTranslation } from 'react-i18next';
4
 import { useTranslation } from 'react-i18next';
5
+import { useSelector } from 'react-redux';
5
 
6
 
6
 import { Avatar } from '../../base/avatar';
7
 import { Avatar } from '../../base/avatar';
7
 import {
8
 import {
11
     IconMicrophoneEmpty,
12
     IconMicrophoneEmpty,
12
     IconMicrophoneEmptySlash
13
     IconMicrophoneEmptySlash
13
 } from '../../base/icons';
14
 } from '../../base/icons';
15
+import { getParticipantDisplayNameWithId } from '../../base/participants';
14
 import { ActionTrigger, MediaState } from '../constants';
16
 import { ActionTrigger, MediaState } from '../constants';
15
 
17
 
16
 import { RaisedHandIndicator } from './RaisedHandIndicator';
18
 import { RaisedHandIndicator } from './RaisedHandIndicator';
125
 }: Props) => {
127
 }: Props) => {
126
     const ParticipantActions = Actions[actionsTrigger];
128
     const ParticipantActions = Actions[actionsTrigger];
127
     const { t } = useTranslation();
129
     const { t } = useTranslation();
130
+    const name = useSelector(getParticipantDisplayNameWithId(p.id));
128
 
131
 
129
     return (
132
     return (
130
         <ParticipantContainer
133
         <ParticipantContainer
138
             <ParticipantContent>
141
             <ParticipantContent>
139
                 <ParticipantNameContainer>
142
                 <ParticipantNameContainer>
140
                     <ParticipantName>
143
                     <ParticipantName>
141
-                        { p.name }
144
+                        { name }
142
                     </ParticipantName>
145
                     </ParticipantName>
143
                     { p.local ? <span>&nbsp;({t('chat.you')})</span> : null }
146
                     { p.local ? <span>&nbsp;({t('chat.you')})</span> : null }
144
                 </ParticipantNameContainer>
147
                 </ParticipantNameContainer>

Laddar…
Avbryt
Spara