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