signal-desktop/ts/components/conversation/SafetyNumberNotification.tsx

73 lines
1.8 KiB
TypeScript
Raw Normal View History

import React from 'react';
import { ContactName } from './ContactName';
import { Intl } from '../Intl';
2019-01-14 21:49:58 +00:00
import { LocalizerType } from '../../types/Util';
interface ContactType {
id: string;
2020-07-24 01:35:32 +00:00
phoneNumber?: string;
profileName?: string;
2020-07-24 01:35:32 +00:00
title: string;
name?: string;
}
export type PropsData = {
isGroup: boolean;
contact: ContactType;
};
type PropsHousekeeping = {
2019-01-14 21:49:58 +00:00
i18n: LocalizerType;
};
export type PropsActions = {
showIdentity: (id: string) => void;
};
type Props = PropsData & PropsHousekeeping & PropsActions;
export class SafetyNumberNotification extends React.Component<Props> {
public render() {
const { contact, isGroup, i18n, showIdentity } = this.props;
2019-01-14 21:49:58 +00:00
const changeKey = isGroup
? 'safetyNumberChangedGroup'
: 'safetyNumberChanged';
return (
<div className="module-safety-number-notification">
<div className="module-safety-number-notification__icon" />
<div className="module-safety-number-notification__text">
<Intl
2019-01-14 21:49:58 +00:00
id={changeKey}
components={[
<span
key="external-1"
className="module-safety-number-notification__contact"
>
<ContactName
name={contact.name}
profileName={contact.profileName}
phoneNumber={contact.phoneNumber}
2020-07-24 01:35:32 +00:00
title={contact.title}
module="module-safety-number-notification__contact"
2020-07-24 01:35:32 +00:00
i18n={i18n}
/>
</span>,
]}
i18n={i18n}
/>
</div>
2019-11-07 21:36:16 +00:00
<button
onClick={() => {
showIdentity(contact.id);
}}
className="module-safety-number-notification__button"
>
{i18n('verifyNewNumber')}
2019-11-07 21:36:16 +00:00
</button>
</div>
);
}
}