| 
									
										
										
										
											2023-01-03 11:55:46 -08:00
										 |  |  | // Copyright 2019 Signal Messenger, LLC
 | 
					
						
							| 
									
										
										
										
											2020-10-30 15:34:04 -05:00
										 |  |  | // SPDX-License-Identifier: AGPL-3.0-only
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-08 14:05:05 -06:00
										 |  |  | import React, { forwardRef } from 'react'; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-26 14:15:33 -05:00
										 |  |  | import type { LocalizerType } from '../../types/Util'; | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-24 06:57:00 -07:00
										 |  |  | export type Props = { | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  |   count: number; | 
					
						
							|  |  |  |   i18n: LocalizerType; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-08 14:05:05 -06:00
										 |  |  | export const LastSeenIndicator = forwardRef<HTMLDivElement, Props>( | 
					
						
							| 
									
										
										
										
											2022-11-17 16:45:19 -08:00
										 |  |  |   function LastSeenIndicatorInner({ count, i18n }, ref) { | 
					
						
							| 
									
										
										
										
											2022-03-08 14:05:05 -06:00
										 |  |  |     const message = | 
					
						
							|  |  |  |       count === 1 | 
					
						
							|  |  |  |         ? i18n('unreadMessage') | 
					
						
							|  |  |  |         : i18n('unreadMessages', [String(count)]); | 
					
						
							| 
									
										
										
										
											2019-03-20 10:42:28 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-08 14:05:05 -06:00
										 |  |  |     return ( | 
					
						
							|  |  |  |       <div className="module-last-seen-indicator" ref={ref}> | 
					
						
							| 
									
										
										
										
											2023-01-23 11:59:12 -05:00
										 |  |  |         <div className="module-last-seen-indicator__bar" role="separator" /> | 
					
						
							|  |  |  |         <div | 
					
						
							|  |  |  |           aria-level={6} | 
					
						
							|  |  |  |           className="module-last-seen-indicator__text" | 
					
						
							|  |  |  |           role="heading" | 
					
						
							|  |  |  |         > | 
					
						
							|  |  |  |           {message} | 
					
						
							|  |  |  |         </div> | 
					
						
							| 
									
										
										
										
											2022-03-08 14:05:05 -06:00
										 |  |  |       </div> | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | ); |