2021-09-07 14:55:03 -05:00
|
|
|
// Copyright 2020-2021 Signal Messenger, LLC
|
2020-10-30 15:34:04 -05:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-07-29 16:20:05 -07:00
|
|
|
import React from 'react';
|
|
|
|
|
2021-10-26 14:15:33 -05:00
|
|
|
import type { LocalizerType } from '../../types/Util';
|
|
|
|
import type { ConversationType } from '../../state/ducks/conversations';
|
2021-09-07 14:55:03 -05:00
|
|
|
import { SystemMessage } from './SystemMessage';
|
2020-09-08 12:56:10 -07:00
|
|
|
import { Emojify } from './Emojify';
|
2021-10-26 14:15:33 -05:00
|
|
|
import type { ProfileNameChangeType } from '../../util/getStringForProfileChange';
|
|
|
|
import { getStringForProfileChange } from '../../util/getStringForProfileChange';
|
2020-07-29 16:20:05 -07:00
|
|
|
|
2021-01-14 12:07:05 -06:00
|
|
|
export type PropsType = {
|
2020-07-29 16:20:05 -07:00
|
|
|
change: ProfileNameChangeType;
|
|
|
|
changedContact: ConversationType;
|
|
|
|
i18n: LocalizerType;
|
2021-01-14 12:07:05 -06:00
|
|
|
};
|
2020-07-29 16:20:05 -07:00
|
|
|
|
|
|
|
export function ProfileChangeNotification(props: PropsType): JSX.Element {
|
|
|
|
const { change, changedContact, i18n } = props;
|
|
|
|
const message = getStringForProfileChange(change, changedContact, i18n);
|
|
|
|
|
2021-09-07 14:55:03 -05:00
|
|
|
return <SystemMessage icon="profile" contents={<Emojify text={message} />} />;
|
2020-07-29 16:20:05 -07:00
|
|
|
}
|