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