Note to Self

This commit is contained in:
Scott Nonnenberg 2019-01-30 17:45:58 -08:00
parent 681ca363fe
commit a43a78731a
15 changed files with 411 additions and 148 deletions

View file

@ -9,6 +9,7 @@ interface Props {
color?: string;
conversationType: 'group' | 'direct';
i18n: Localizer;
noteToSelf?: boolean;
name?: string;
phoneNumber?: string;
profileName?: string;
@ -63,11 +64,23 @@ export class Avatar extends React.Component<Props, State> {
}
public renderNoImage() {
const { conversationType, name, size } = this.props;
const { conversationType, name, noteToSelf, size } = this.props;
const initials = getInitials(name);
const isGroup = conversationType === 'group';
if (noteToSelf) {
return (
<div
className={classNames(
'module-avatar__icon',
'module-avatar__icon--note-to-self',
`module-avatar__icon--${size}`
)}
/>
);
}
if (!isGroup && initials) {
return (
<div
@ -93,10 +106,10 @@ export class Avatar extends React.Component<Props, State> {
}
public render() {
const { avatarPath, color, size } = this.props;
const { avatarPath, color, size, noteToSelf } = this.props;
const { imageBroken } = this.state;
const hasImage = avatarPath && !imageBroken;
const hasImage = !noteToSelf && avatarPath && !imageBroken;
if (size !== 28 && size !== 36 && size !== 48 && size !== 80) {
throw new Error(`Size ${size} is not supported!`);