2021-11-10 17:49:53 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react';
|
2022-09-27 07:10:28 +00:00
|
|
|
import { Text, View } from 'react-native';
|
2021-11-10 17:49:53 +00:00
|
|
|
|
2021-12-28 14:35:21 +00:00
|
|
|
import { Avatar, StatelessAvatar } from '../../../base/avatar';
|
|
|
|
import { getInitials } from '../../../base/avatar/functions';
|
2021-11-10 17:49:53 +00:00
|
|
|
import BaseTheme from '../../../base/ui/components/BaseTheme.native';
|
|
|
|
|
|
|
|
import TimeElapsed from './TimeElapsed';
|
|
|
|
import style from './styles';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The name of the participant.
|
|
|
|
*/
|
|
|
|
displayName: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* True if the participant is currently the dominant speaker.
|
|
|
|
*/
|
|
|
|
isDominantSpeaker: boolean
|
|
|
|
};
|
|
|
|
|
2021-12-28 14:35:21 +00:00
|
|
|
const SpeakerStatsItem = (props: Props) =>
|
|
|
|
(
|
2021-11-10 17:49:53 +00:00
|
|
|
<View
|
2021-11-29 09:33:38 +00:00
|
|
|
key = { props.participantId }
|
2021-11-10 17:49:53 +00:00
|
|
|
style = { style.speakerStatsItemContainer }>
|
2021-12-28 14:35:21 +00:00
|
|
|
<View style = { style.speakerStatsAvatar }>
|
|
|
|
{
|
|
|
|
props.hasLeft ? (
|
|
|
|
<StatelessAvatar
|
|
|
|
className = 'userAvatar'
|
|
|
|
color = { BaseTheme.palette.ui05 }
|
|
|
|
id = 'avatar'
|
|
|
|
initials = { getInitials(props.displayName) }
|
|
|
|
size = { BaseTheme.spacing[5] } />
|
|
|
|
) : (
|
|
|
|
<Avatar
|
|
|
|
className = 'userAvatar'
|
|
|
|
participantId = { props.participantId }
|
|
|
|
size = { BaseTheme.spacing[5] } />
|
|
|
|
)
|
|
|
|
}
|
2021-11-10 17:49:53 +00:00
|
|
|
</View>
|
2021-12-28 14:35:21 +00:00
|
|
|
<View style = { style.speakerStatsNameTime } >
|
|
|
|
<Text style = { [ style.speakerStatsText, props.hasLeft && style.speakerStatsLeft ] }>
|
|
|
|
{props.displayName}
|
2021-11-10 17:49:53 +00:00
|
|
|
</Text>
|
|
|
|
<TimeElapsed
|
2021-12-28 14:35:21 +00:00
|
|
|
style = { [
|
|
|
|
style.speakerStatsText,
|
|
|
|
style.speakerStatsTime,
|
|
|
|
props.isDominantSpeaker && style.speakerStatsDominant,
|
|
|
|
props.hasLeft && style.speakerStatsLeft
|
|
|
|
] }
|
2021-11-10 17:49:53 +00:00
|
|
|
time = { props.dominantSpeakerTime } />
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default SpeakerStatsItem;
|