diff --git a/app/lib/components/Notifications.jsx b/app/lib/components/Notifications.jsx
index d38db4d..c79a1be 100644
--- a/app/lib/components/Notifications.jsx
+++ b/app/lib/components/Notifications.jsx
@@ -1,104 +1,83 @@
-import React from 'react';
+import React, { useRef, useEffect } from 'react';
import { connect } from 'react-redux';
-import classnames from 'classnames';
import PropTypes from 'prop-types';
import * as appPropTypes from './appPropTypes';
import * as stateActions from '../redux/stateActions';
-import { Appear } from './transitions';
const Notifications = ({ notifications, onClick }) => {
- console.log("notifications", notifications);
+ const chatwarpRef = useRef(null);
- return (
-
-
聊天
+ useEffect(() => {
+ if (chatwarpRef.current) {
+ chatwarpRef.current.scrollTop = chatwarpRef.current.scrollHeight;
+ }
+ }, [notifications]);
-
- {
- notifications.map((notification) => {
- return (
-
- {
- // 类型是否是用户发送的消息
- notification.type == 'userMessage' ?
-
- {
- notification.isMe ?
-
-
我
-
- {notification.text}
-
-
:
- <>
-
用户-{notification.id}
-
- {notification.text}
-
- >
- }
-
:
-
- {notification.text}
-
- }
+ return (
+
-
-
- // 信息提示动画
- //
- // onClick(notification.id)}
- // >
- //
-
- //
- //
- // {notification.title}
- //
-
- //
{notification.text}
- //
- //
- //
- );
- })
- }
-
-
- );
+
+ {
+ notifications.map((notification) => (
+
+ {
+ notification.type === 'userMessage' ?
+
+ {
+ notification.isMe ?
+
+
我
+
+ {notification.text}
+
+
:
+ <>
+
用户-{notification.id}
+
+ {notification.text}
+
+ >
+ }
+
:
+
+ {notification.text}
+
+ }
+
+ ))
+ }
+
+
+ );
};
-Notifications.propTypes =
-{
- notifications: PropTypes.arrayOf(appPropTypes.Notification).isRequired,
- onClick: PropTypes.func.isRequired
+Notifications.propTypes = {
+ notifications: PropTypes.arrayOf(appPropTypes.Notification).isRequired,
+ onClick: PropTypes.func.isRequired
};
const mapStateToProps = (state) => {
- const { notifications } = state;
-
- return { notifications };
+ const { notifications } = state;
+ return { notifications };
};
const mapDispatchToProps = (dispatch) => {
- return {
- onClick: (notificationId) => {
- dispatch(stateActions.removeNotification(notificationId));
- }
- };
+ return {
+ onClick: (notificationId) => {
+ dispatch(stateActions.removeNotification(notificationId));
+ }
+ };
};
const NotificationsContainer = connect(
- mapStateToProps,
- mapDispatchToProps
+ mapStateToProps,
+ mapDispatchToProps
)(Notifications);
export default NotificationsContainer;
diff --git a/server/config.js b/server/config.js
index d4b0f94..f2243b5 100644
--- a/server/config.js
+++ b/server/config.js
@@ -17,7 +17,7 @@ module.exports =
// Signaling settings (protoo WebSocket server and HTTP API server).
https :
{
- listenIp : '0.0.0.0', // 换成你的IP地址
+ listenIp : '192.168.0.167', // 换成你的IP地址
// NOTE: Don't change listenPort (client app assumes 4443).
listenPort : process.env.PROTOO_LISTEN_PORT || 4443,
// NOTE: Set your own valid certificate files.