2018-10-30 05:02:23 +00:00
|
|
|
/* @flow */
|
2021-12-28 14:35:21 +00:00
|
|
|
import { makeStyles } from '@material-ui/core/styles';
|
|
|
|
import React from 'react';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
2018-10-30 05:02:23 +00:00
|
|
|
|
2021-11-10 17:49:53 +00:00
|
|
|
import { Tooltip } from '../../../base/tooltip';
|
2022-05-06 12:41:08 +00:00
|
|
|
import { FACE_EXPRESSIONS_EMOJIS } from '../../../face-landmarks/constants';
|
2017-02-17 00:59:30 +00:00
|
|
|
|
2021-12-28 14:35:21 +00:00
|
|
|
const useStyles = makeStyles(theme => {
|
|
|
|
return {
|
|
|
|
labels: {
|
|
|
|
padding: '22px 0 7px 0',
|
|
|
|
height: 20
|
|
|
|
},
|
|
|
|
emojis: {
|
|
|
|
paddingLeft: 27,
|
|
|
|
...theme.typography.bodyShortRegularLarge,
|
|
|
|
lineHeight: `${theme.typography.bodyShortRegular.lineHeightLarge}px`
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2017-02-17 00:59:30 +00:00
|
|
|
/**
|
2018-10-30 05:02:23 +00:00
|
|
|
* The type of the React {@code Component} props of {@link SpeakerStatsLabels}.
|
2017-02-17 00:59:30 +00:00
|
|
|
*/
|
2018-10-30 05:02:23 +00:00
|
|
|
type Props = {
|
|
|
|
|
2021-11-17 14:33:03 +00:00
|
|
|
/**
|
2022-04-06 09:10:31 +00:00
|
|
|
* True if the face expressions detection is not disabled.
|
2021-11-17 14:33:03 +00:00
|
|
|
*/
|
2022-04-06 09:10:31 +00:00
|
|
|
showFaceExpressions: boolean,
|
2018-10-30 05:02:23 +00:00
|
|
|
};
|
2017-02-17 00:59:30 +00:00
|
|
|
|
2021-12-28 14:35:21 +00:00
|
|
|
const SpeakerStatsLabels = (props: Props) => {
|
|
|
|
const { t } = useTranslation();
|
|
|
|
const classes = useStyles();
|
2022-04-06 09:10:31 +00:00
|
|
|
const FaceExpressionsLabels = () => Object.keys(FACE_EXPRESSIONS_EMOJIS).map(
|
2021-12-28 14:35:21 +00:00
|
|
|
expression => (
|
2021-11-17 14:33:03 +00:00
|
|
|
<div
|
2021-12-28 14:35:21 +00:00
|
|
|
className = 'expression'
|
|
|
|
key = { expression }>
|
|
|
|
<Tooltip
|
|
|
|
content = { t(`speakerStats.${expression}`) }
|
|
|
|
position = { 'top' } >
|
|
|
|
<div>
|
2022-04-06 09:10:31 +00:00
|
|
|
{ FACE_EXPRESSIONS_EMOJIS[expression] }
|
2021-12-28 14:35:21 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
</Tooltip>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
);
|
|
|
|
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
|
|
|
}`;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className = { `row ${classes.labels}` }>
|
|
|
|
<div className = 'avatar' />
|
|
|
|
|
|
|
|
<div className = { nameTimeClass }>
|
|
|
|
<div>
|
2017-02-17 00:59:30 +00:00
|
|
|
{ t('speakerStats.name') }
|
|
|
|
</div>
|
2021-12-28 14:35:21 +00:00
|
|
|
<div>
|
2017-02-17 00:59:30 +00:00
|
|
|
{ t('speakerStats.speakerTime') }
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-12-28 14:35:21 +00:00
|
|
|
{
|
2022-04-06 09:10:31 +00:00
|
|
|
props.showFaceExpressions
|
2021-12-28 14:35:21 +00:00
|
|
|
&& <div className = { `expressions ${classes.emojis}` }>
|
2022-04-06 09:10:31 +00:00
|
|
|
<FaceExpressionsLabels />
|
2021-12-28 14:35:21 +00:00
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
2017-02-17 00:59:30 +00:00
|
|
|
|
2021-12-28 14:35:21 +00:00
|
|
|
export default SpeakerStatsLabels;
|