2021-11-10 17:49:53 +00:00
|
|
|
/* @flow */
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
2021-12-28 14:35:21 +00:00
|
|
|
import { Avatar, StatelessAvatar } from '../../../base/avatar';
|
|
|
|
import { getInitials } from '../../../base/avatar/functions';
|
|
|
|
import BaseTheme from '../../../base/ui/components/BaseTheme';
|
2022-05-06 12:41:08 +00:00
|
|
|
import { FACE_EXPRESSIONS } from '../../../face-landmarks/constants';
|
2021-12-28 14:35:21 +00:00
|
|
|
|
2021-11-10 17:49:53 +00:00
|
|
|
import TimeElapsed from './TimeElapsed';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of {@link SpeakerStatsItem}.
|
|
|
|
*/
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The name of the participant.
|
|
|
|
*/
|
|
|
|
displayName: string,
|
|
|
|
|
|
|
|
/**
|
2022-04-06 09:10:31 +00:00
|
|
|
* The object that has as keys the face expressions of the
|
2021-11-10 17:49:53 +00:00
|
|
|
* participant and as values a number that represents the count .
|
|
|
|
*/
|
2022-04-06 09:10:31 +00:00
|
|
|
faceExpressions: Object,
|
2021-11-10 17:49:53 +00:00
|
|
|
|
|
|
|
/**
|
2022-04-06 09:10:31 +00:00
|
|
|
* True if the face expressions detection is not disabled.
|
2021-11-10 17:49:53 +00:00
|
|
|
*/
|
2022-04-06 09:10:31 +00:00
|
|
|
showFaceExpressions: boolean,
|
2021-11-10 17:49:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The total milliseconds the participant has been dominant speaker.
|
|
|
|
*/
|
|
|
|
dominantSpeakerTime: number,
|
|
|
|
|
2021-11-29 09:33:38 +00:00
|
|
|
/**
|
|
|
|
* The id of the user.
|
|
|
|
*/
|
|
|
|
participantId: string,
|
|
|
|
|
2021-11-10 17:49:53 +00:00
|
|
|
/**
|
|
|
|
* True if the participant is no longer in the meeting.
|
|
|
|
*/
|
|
|
|
hasLeft: boolean,
|
|
|
|
|
2021-12-28 14:35:21 +00:00
|
|
|
/**
|
|
|
|
* True if the participant is not shown in speaker stats.
|
|
|
|
*/
|
|
|
|
hidden: boolean,
|
|
|
|
|
2021-11-10 17:49:53 +00:00
|
|
|
/**
|
|
|
|
* True if the participant is currently the dominant speaker.
|
|
|
|
*/
|
|
|
|
isDominantSpeaker: boolean,
|
|
|
|
|
2021-12-28 14:35:21 +00:00
|
|
|
/**
|
|
|
|
* Styles for the item.
|
|
|
|
*/
|
|
|
|
styles: Object,
|
|
|
|
|
2021-11-10 17:49:53 +00:00
|
|
|
/**
|
|
|
|
* Invoked to obtain translated strings.
|
|
|
|
*/
|
|
|
|
t: Function
|
2021-12-28 14:35:21 +00:00
|
|
|
}
|
2021-11-10 17:49:53 +00:00
|
|
|
|
|
|
|
const SpeakerStatsItem = (props: Props) => {
|
2021-12-28 14:35:21 +00:00
|
|
|
const hasLeftClass = props.hasLeft ? props.styles.hasLeft : '';
|
|
|
|
const rowDisplayClass = `row ${hasLeftClass} ${props.styles.item}`;
|
|
|
|
const expressionClass = 'expression';
|
|
|
|
const nameTimeClass = `name-time${
|
2022-04-06 09:10:31 +00:00
|
|
|
props.showFaceExpressions ? ' name-time_expressions-on' : ''
|
2021-12-28 14:35:21 +00:00
|
|
|
}`;
|
|
|
|
const timeClass = `${props.styles.time} ${props.isDominantSpeaker ? props.styles.dominant : ''}`;
|
|
|
|
|
|
|
|
|
2022-04-06 09:10:31 +00:00
|
|
|
const FaceExpressions = () => FACE_EXPRESSIONS.map(
|
2021-12-28 14:35:21 +00:00
|
|
|
expression => (
|
|
|
|
<div
|
|
|
|
aria-label = { props.t(`speakerStats.${expression}`) }
|
|
|
|
className = {
|
|
|
|
`${expressionClass} ${
|
2022-04-06 09:10:31 +00:00
|
|
|
props.faceExpressions[expression] === 0 ? props.styles.hasLeft : ''
|
2021-12-28 14:35:21 +00:00
|
|
|
}`
|
|
|
|
}
|
|
|
|
key = { expression }>
|
2022-04-06 09:10:31 +00:00
|
|
|
{ props.faceExpressions[expression] }
|
2021-12-28 14:35:21 +00:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
);
|
2021-11-10 17:49:53 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className = { rowDisplayClass }
|
2021-11-29 09:33:38 +00:00
|
|
|
key = { props.participantId } >
|
2021-12-28 14:35:21 +00:00
|
|
|
<div className = { `avatar ${props.styles.avatar}` }>
|
|
|
|
{
|
|
|
|
props.hasLeft ? (
|
|
|
|
<StatelessAvatar
|
|
|
|
className = 'userAvatar'
|
|
|
|
color = { BaseTheme.palette.ui04 }
|
|
|
|
id = 'avatar'
|
|
|
|
initials = { getInitials(props.displayName) } />
|
|
|
|
) : (
|
|
|
|
<Avatar
|
|
|
|
className = 'userAvatar'
|
|
|
|
participantId = { props.participantId } />
|
|
|
|
)
|
|
|
|
}
|
2021-11-10 17:49:53 +00:00
|
|
|
</div>
|
2021-12-28 14:35:21 +00:00
|
|
|
<div className = { nameTimeClass }>
|
|
|
|
<div
|
|
|
|
aria-label = { props.t('speakerStats.speakerStats') }
|
|
|
|
className = { props.styles.displayName }>
|
|
|
|
{ props.displayName }
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
aria-label = { props.t('speakerStats.speakerTime') }
|
|
|
|
className = { timeClass }>
|
|
|
|
<TimeElapsed
|
|
|
|
time = { props.dominantSpeakerTime } />
|
|
|
|
</div>
|
2021-11-10 17:49:53 +00:00
|
|
|
</div>
|
2022-04-06 09:10:31 +00:00
|
|
|
{ props.showFaceExpressions
|
2021-11-10 17:49:53 +00:00
|
|
|
&& (
|
2021-12-28 14:35:21 +00:00
|
|
|
<div className = { `expressions ${props.styles.expressions}` }>
|
2022-04-06 09:10:31 +00:00
|
|
|
<FaceExpressions />
|
2021-12-28 14:35:21 +00:00
|
|
|
</div>
|
|
|
|
)}
|
2021-11-10 17:49:53 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SpeakerStatsItem;
|