|  |  | @ -1,13 +1,17 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | import React from 'react'; |  |  |  | import React, { useRef, useEffect } from 'react'; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | import { connect } from 'react-redux'; |  |  |  | import { connect } from 'react-redux'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import classnames from 'classnames'; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import PropTypes from 'prop-types'; |  |  |  | import PropTypes from 'prop-types'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import * as appPropTypes from './appPropTypes'; |  |  |  | import * as appPropTypes from './appPropTypes'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import * as stateActions from '../redux/stateActions'; |  |  |  | import * as stateActions from '../redux/stateActions'; | 
			
		
	
		
		
			
				
					
					|  |  |  | import { Appear } from './transitions'; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | const Notifications = ({ notifications, onClick }) => { |  |  |  | const Notifications = ({ notifications, onClick }) => { | 
			
		
	
		
		
			
				
					
					|  |  |  | 	console.log("notifications", notifications); |  |  |  |     const chatwarpRef = useRef(null); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     useEffect(() => { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (chatwarpRef.current) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             chatwarpRef.current.scrollTop = chatwarpRef.current.scrollHeight; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     }, [notifications]); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     return ( |  |  |  |     return ( | 
			
		
	
		
		
			
				
					
					|  |  |  |         <div data-component='Notifications' style={{ |  |  |  |         <div data-component='Notifications' style={{ | 
			
		
	
	
		
		
			
				
					|  |  | @ -18,14 +22,12 @@ const Notifications = ({ notifications, onClick }) => { | 
			
		
	
		
		
			
				
					
					|  |  |  |         }}> |  |  |  |         }}> | 
			
		
	
		
		
			
				
					
					|  |  |  |             <div className='chatTitle'>聊天</div> |  |  |  |             <div className='chatTitle'>聊天</div> | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			<div className='chatwarp'> |  |  |  |             <div className='chatwarp' ref={chatwarpRef}> | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 { |  |  |  |                 { | 
			
		
	
		
		
			
				
					
					|  |  |  | 					notifications.map((notification) => { |  |  |  |                     notifications.map((notification) => ( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 						return ( |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                         <div key={notification.id} style={{ padding: '0 20px', fontSize: '14px' }}> |  |  |  |                         <div key={notification.id} style={{ padding: '0 20px', fontSize: '14px' }}> | 
			
		
	
		
		
			
				
					
					|  |  |  |                             { |  |  |  |                             { | 
			
		
	
		
		
			
				
					
					|  |  |  | 									// 类型是否是用户发送的消息 |  |  |  |                                 notification.type === 'userMessage' ? | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 									notification.type == 'userMessage' ? |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                                     <div style={{marginTop: 36}}> |  |  |  |                                     <div style={{marginTop: 36}}> | 
			
		
	
		
		
			
				
					
					|  |  |  |                                         { |  |  |  |                                         { | 
			
		
	
		
		
			
				
					
					|  |  |  |                                             notification.isMe ? |  |  |  |                                             notification.isMe ? | 
			
		
	
	
		
		
			
				
					|  |  | @ -43,48 +45,25 @@ const Notifications = ({ notifications, onClick }) => { | 
			
		
	
		
		
			
				
					
					|  |  |  |                                                 </> |  |  |  |                                                 </> | 
			
		
	
		
		
			
				
					
					|  |  |  |                                         } |  |  |  |                                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |                                     </div> : |  |  |  |                                     </div> : | 
			
		
	
		
		
			
				
					
					|  |  |  | 										<div style={{width: '100%', margin: '20px 0', textAlign: 'center'}}> |  |  |  |                                     <div style={{width: '100%', margin: '30px 0', textAlign: 'center'}}> | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                                         {notification.text} |  |  |  |                                         {notification.text} | 
			
		
	
		
		
			
				
					
					|  |  |  |                                     </div> |  |  |  |                                     </div> | 
			
		
	
		
		
			
				
					
					|  |  |  |                             } |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         </div> |  |  |  |                         </div> | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |                     )) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 							// 信息提示动画 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 							// <Appear key={notification.id} duration={250}> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 							// 	<div |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 							// 		className={classnames('notification', notification.type)} |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 							// 		onClick={() => onClick(notification.id)} |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 							// 	> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 							// 		<div className='icon' /> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 							// 		<div className='body'> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 							// 			<If condition={notification.title}> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 							// 				<p className='title'>{notification.title}</p> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 							// 			</If> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 							// 			<p className='text'>{notification.text}</p> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 							// 		</div> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 							// 	</div> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 							// </Appear> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 						); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 					}) |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |             </div> |  |  |  |             </div> | 
			
		
	
		
		
			
				
					
					|  |  |  |         </div> |  |  |  |         </div> | 
			
		
	
		
		
			
				
					
					|  |  |  |     ); |  |  |  |     ); | 
			
		
	
		
		
			
				
					
					|  |  |  | }; |  |  |  | }; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | Notifications.propTypes = |  |  |  | Notifications.propTypes = { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | { |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     notifications: PropTypes.arrayOf(appPropTypes.Notification).isRequired, |  |  |  |     notifications: PropTypes.arrayOf(appPropTypes.Notification).isRequired, | 
			
		
	
		
		
			
				
					
					|  |  |  |     onClick: PropTypes.func.isRequired |  |  |  |     onClick: PropTypes.func.isRequired | 
			
		
	
		
		
			
				
					
					|  |  |  | }; |  |  |  | }; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | const mapStateToProps = (state) => { |  |  |  | const mapStateToProps = (state) => { | 
			
		
	
		
		
			
				
					
					|  |  |  |     const { notifications } = state; |  |  |  |     const { notifications } = state; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     return { notifications }; |  |  |  |     return { notifications }; | 
			
		
	
		
		
			
				
					
					|  |  |  | }; |  |  |  | }; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | 
 |