signal-desktop/ts/components/conversationList/StartNewConversation.tsx

56 lines
1.4 KiB
TypeScript
Raw Normal View History

// Copyright 2019-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { FunctionComponent } from 'react';
import React, { useCallback } from 'react';
import {
BaseConversationListItem,
MESSAGE_TEXT_CLASS_NAME,
} from './BaseConversationListItem';
import type { LocalizerType } from '../../types/Util';
2021-08-06 00:17:05 +00:00
import { AvatarColors } from '../../types/Colors';
const TEXT_CLASS_NAME = `${MESSAGE_TEXT_CLASS_NAME}__start-new-conversation`;
type PropsData = {
phoneNumber: string;
};
type PropsHousekeeping = {
i18n: LocalizerType;
2021-08-11 16:23:21 +00:00
onClick: (phoneNumber: string) => void;
};
export type Props = PropsData & PropsHousekeeping;
export const StartNewConversation: FunctionComponent<Props> = React.memo(
2021-08-11 19:29:07 +00:00
function StartNewConversation({ i18n, onClick, phoneNumber }) {
const messageText = (
<div className={TEXT_CLASS_NAME}>{i18n('startConversation')}</div>
);
2021-08-11 16:23:21 +00:00
const boundOnClick = useCallback(() => {
onClick(phoneNumber);
}, [onClick, phoneNumber]);
return (
<BaseConversationListItem
2021-05-07 22:21:10 +00:00
acceptedMessageRequest={false}
2021-08-06 00:17:05 +00:00
color={AvatarColors[0]}
conversationType="direct"
headerName={phoneNumber}
i18n={i18n}
2021-05-07 22:21:10 +00:00
isMe={false}
isSelected={false}
messageText={messageText}
2021-08-11 16:23:21 +00:00
onClick={boundOnClick}
phoneNumber={phoneNumber}
2021-05-07 22:21:10 +00:00
sharedGroupNames={[]}
title={phoneNumber}
/>
);
}
);