| 
									
										
										
										
											2021-02-18 08:40:26 -08:00
										 |  |  | // Copyright 2021 Signal Messenger, LLC
 | 
					
						
							|  |  |  | // SPDX-License-Identifier: AGPL-3.0-only
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import * as React from 'react'; | 
					
						
							|  |  |  | import classNames from 'classnames'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-28 12:11:19 -07:00
										 |  |  | import { Modal } from '../Modal'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-17 18:24:21 -04:00
										 |  |  | import { useRestoreFocus } from '../../hooks/useRestoreFocus'; | 
					
						
							| 
									
										
										
										
											2021-07-30 13:30:59 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import type { LocalizerType } from '../../types/Util'; | 
					
						
							| 
									
										
										
										
											2021-02-18 08:40:26 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | export type PropsType = { | 
					
						
							|  |  |  |   i18n: LocalizerType; | 
					
						
							|  |  |  |   contactSupport: () => unknown; | 
					
						
							|  |  |  |   onClose: () => unknown; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function ChatSessionRefreshedDialog( | 
					
						
							|  |  |  |   props: PropsType | 
					
						
							|  |  |  | ): React.ReactElement { | 
					
						
							|  |  |  |   const { i18n, contactSupport, onClose } = props; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-30 13:30:59 -07:00
										 |  |  |   // Focus first button after initial render, restore focus on teardown
 | 
					
						
							|  |  |  |   const [focusRef] = useRestoreFocus(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-18 08:40:26 -08:00
										 |  |  |   return ( | 
					
						
							| 
									
										
										
										
											2022-09-27 13:24:21 -07:00
										 |  |  |     <Modal | 
					
						
							|  |  |  |       modalName="ChatSessionRefreshedDialog" | 
					
						
							|  |  |  |       hasXButton={false} | 
					
						
							|  |  |  |       onClose={onClose} | 
					
						
							|  |  |  |       i18n={i18n} | 
					
						
							|  |  |  |     > | 
					
						
							| 
									
										
										
										
											2021-05-28 12:11:19 -07:00
										 |  |  |       <div className="module-chat-session-refreshed-dialog"> | 
					
						
							|  |  |  |         <div className="module-chat-session-refreshed-dialog__image"> | 
					
						
							|  |  |  |           <img | 
					
						
							|  |  |  |             src="images/chat-session-refresh.svg" | 
					
						
							|  |  |  |             height="110" | 
					
						
							|  |  |  |             width="200" | 
					
						
							|  |  |  |             alt="" | 
					
						
							|  |  |  |           /> | 
					
						
							|  |  |  |         </div> | 
					
						
							|  |  |  |         <div className="module-chat-session-refreshed-dialog__title"> | 
					
						
							|  |  |  |           {i18n('ChatRefresh--notification')} | 
					
						
							|  |  |  |         </div> | 
					
						
							|  |  |  |         <div className="module-chat-session-refreshed-dialog__description"> | 
					
						
							|  |  |  |           {i18n('ChatRefresh--summary')} | 
					
						
							|  |  |  |         </div> | 
					
						
							|  |  |  |         <div className="module-chat-session-refreshed-dialog__buttons"> | 
					
						
							|  |  |  |           <button | 
					
						
							|  |  |  |             type="button" | 
					
						
							|  |  |  |             onClick={contactSupport} | 
					
						
							|  |  |  |             className={classNames( | 
					
						
							|  |  |  |               'module-chat-session-refreshed-dialog__button', | 
					
						
							|  |  |  |               'module-chat-session-refreshed-dialog__button--secondary' | 
					
						
							|  |  |  |             )} | 
					
						
							|  |  |  |           > | 
					
						
							|  |  |  |             {i18n('ChatRefresh--contactSupport')} | 
					
						
							|  |  |  |           </button> | 
					
						
							|  |  |  |           <button | 
					
						
							|  |  |  |             type="button" | 
					
						
							|  |  |  |             onClick={onClose} | 
					
						
							| 
									
										
										
										
											2021-07-30 13:30:59 -07:00
										 |  |  |             ref={focusRef} | 
					
						
							| 
									
										
										
										
											2021-05-28 12:11:19 -07:00
										 |  |  |             className="module-chat-session-refreshed-dialog__button" | 
					
						
							|  |  |  |           > | 
					
						
							|  |  |  |             {i18n('Confirmation--confirm')} | 
					
						
							|  |  |  |           </button> | 
					
						
							|  |  |  |         </div> | 
					
						
							| 
									
										
										
										
											2021-02-18 08:40:26 -08:00
										 |  |  |       </div> | 
					
						
							| 
									
										
										
										
											2021-05-28 12:11:19 -07:00
										 |  |  |     </Modal> | 
					
						
							| 
									
										
										
										
											2021-02-18 08:40:26 -08:00
										 |  |  |   ); | 
					
						
							|  |  |  | } |