2018-11-14 19:10:32 +00:00
|
|
|
import React from 'react';
|
|
|
|
import classNames from 'classnames';
|
|
|
|
|
|
|
|
import { TypingAnimation } from './TypingAnimation';
|
|
|
|
import { Avatar } from '../Avatar';
|
|
|
|
|
2020-08-13 20:53:45 +00:00
|
|
|
import { LocalizerType } from '../../types/Util';
|
|
|
|
import { ColorType } from '../../types/Colors';
|
2018-11-14 19:10:32 +00:00
|
|
|
|
|
|
|
interface Props {
|
|
|
|
avatarPath?: string;
|
2020-03-26 21:47:35 +00:00
|
|
|
color: ColorType;
|
2019-05-31 22:42:01 +00:00
|
|
|
name?: string;
|
2020-07-24 01:35:32 +00:00
|
|
|
phoneNumber?: string;
|
2019-05-31 22:42:01 +00:00
|
|
|
profileName?: string;
|
2020-07-24 01:35:32 +00:00
|
|
|
title: string;
|
2019-05-31 22:42:01 +00:00
|
|
|
conversationType: 'group' | 'direct';
|
2019-01-14 21:49:58 +00:00
|
|
|
i18n: LocalizerType;
|
2018-11-14 19:10:32 +00:00
|
|
|
}
|
|
|
|
|
2019-05-31 22:42:01 +00:00
|
|
|
export class TypingBubble extends React.PureComponent<Props> {
|
2018-11-14 19:10:32 +00:00
|
|
|
public renderAvatar() {
|
|
|
|
const {
|
|
|
|
avatarPath,
|
|
|
|
color,
|
|
|
|
name,
|
|
|
|
phoneNumber,
|
|
|
|
profileName,
|
2020-07-24 01:35:32 +00:00
|
|
|
title,
|
2018-11-14 19:10:32 +00:00
|
|
|
conversationType,
|
|
|
|
i18n,
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
if (conversationType !== 'group') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="module-message__author-avatar">
|
|
|
|
<Avatar
|
|
|
|
avatarPath={avatarPath}
|
|
|
|
color={color}
|
|
|
|
conversationType="direct"
|
|
|
|
i18n={i18n}
|
|
|
|
name={name}
|
|
|
|
phoneNumber={phoneNumber}
|
|
|
|
profileName={profileName}
|
2020-07-24 01:35:32 +00:00
|
|
|
title={title}
|
2019-10-04 18:06:17 +00:00
|
|
|
size={28}
|
2018-11-14 19:10:32 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public render() {
|
2019-05-31 22:42:01 +00:00
|
|
|
const { i18n, color, conversationType } = this.props;
|
|
|
|
const isGroup = conversationType === 'group';
|
2018-11-14 19:10:32 +00:00
|
|
|
|
|
|
|
return (
|
2019-05-31 22:42:01 +00:00
|
|
|
<div
|
|
|
|
className={classNames(
|
|
|
|
'module-message',
|
|
|
|
'module-message--incoming',
|
|
|
|
isGroup ? 'module-message--group' : null
|
|
|
|
)}
|
|
|
|
>
|
2018-11-14 19:10:32 +00:00
|
|
|
<div
|
|
|
|
className={classNames(
|
|
|
|
'module-message__container',
|
|
|
|
'module-message__container--incoming',
|
|
|
|
`module-message__container--incoming-${color}`
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
<div className="module-message__typing-container">
|
|
|
|
<TypingAnimation color="light" i18n={i18n} />
|
|
|
|
</div>
|
|
|
|
{this.renderAvatar()}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|