| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  | // Copyright 2021 Signal Messenger, LLC
 | 
					
						
							|  |  |  | // SPDX-License-Identifier: AGPL-3.0-only
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import React from 'react'; | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import type { ConversationType } from '../../state/ducks/conversations'; | 
					
						
							|  |  |  | import type { LocalizerType } from '../../types/Util'; | 
					
						
							| 
									
										
										
										
											2022-03-14 18:32:07 -07:00
										 |  |  | import { isAccessControlEnabled } from '../../groups/util'; | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | import { ConfirmationDialog } from '../ConfirmationDialog'; | 
					
						
							|  |  |  | import { Intl } from '../Intl'; | 
					
						
							|  |  |  | import { ContactName } from './ContactName'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type PropsType = { | 
					
						
							| 
									
										
										
										
											2022-03-14 18:32:07 -07:00
										 |  |  |   group: ConversationType; | 
					
						
							| 
									
										
										
										
											2021-06-01 18:30:25 -05:00
										 |  |  |   conversation: ConversationType; | 
					
						
							|  |  |  |   i18n: LocalizerType; | 
					
						
							|  |  |  |   onClose: () => void; | 
					
						
							|  |  |  |   onRemove: () => void; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | export function RemoveGroupMemberConfirmationDialog({ | 
					
						
							|  |  |  |   conversation, | 
					
						
							|  |  |  |   group, | 
					
						
							|  |  |  |   i18n, | 
					
						
							|  |  |  |   onClose, | 
					
						
							|  |  |  |   onRemove, | 
					
						
							|  |  |  | }: PropsType): JSX.Element { | 
					
						
							| 
									
										
										
										
											2023-01-05 14:43:33 -08:00
										 |  |  |   const accessControlEnabled = isAccessControlEnabled( | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |     group.accessControlAddFromInviteLink | 
					
						
							| 
									
										
										
										
											2023-01-05 14:43:33 -08:00
										 |  |  |   ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   const intlComponents = { | 
					
						
							|  |  |  |     name: <ContactName title={conversation.title} />, | 
					
						
							|  |  |  |   }; | 
					
						
							| 
									
										
										
										
											2022-03-14 18:32:07 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |   return ( | 
					
						
							|  |  |  |     <ConfirmationDialog | 
					
						
							| 
									
										
										
										
											2022-09-27 13:24:21 -07:00
										 |  |  |       dialogName="RemoveGroupMemberConfirmationDialog" | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |       actions={[ | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           action: onRemove, | 
					
						
							|  |  |  |           text: i18n('RemoveGroupMemberConfirmation__remove-button'), | 
					
						
							|  |  |  |           style: 'negative', | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |       ]} | 
					
						
							|  |  |  |       i18n={i18n} | 
					
						
							|  |  |  |       onClose={onClose} | 
					
						
							|  |  |  |       title={ | 
					
						
							| 
									
										
										
										
											2023-01-05 14:43:33 -08:00
										 |  |  |         accessControlEnabled ? ( | 
					
						
							|  |  |  |           <Intl | 
					
						
							|  |  |  |             i18n={i18n} | 
					
						
							|  |  |  |             id="RemoveGroupMemberConfirmation__description__with-link" | 
					
						
							|  |  |  |             components={intlComponents} | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         ) : ( | 
					
						
							|  |  |  |           <Intl | 
					
						
							|  |  |  |             i18n={i18n} | 
					
						
							|  |  |  |             id="RemoveGroupMemberConfirmation__description" | 
					
						
							|  |  |  |             components={intlComponents} | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         ) | 
					
						
							| 
									
										
										
										
											2022-03-22 13:45:34 -07:00
										 |  |  |       } | 
					
						
							|  |  |  |     /> | 
					
						
							|  |  |  |   ); | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  | } |