|
@@ -1,4 +1,4 @@
|
|
|
-import React, { Component, useState, useEffect } from "react";
|
|
|
+import React, { Component } from "react";
|
|
|
import { TeamOutlined, FormOutlined, SearchOutlined } from "@ant-design/icons";
|
|
|
import { connect } from "react-redux";
|
|
|
import "./myProfile.css";
|
|
@@ -6,6 +6,7 @@ import "./myProfile.css";
|
|
|
import ChatGroupsBar from "./chatGroups/chatGroups";
|
|
|
import ChatMessage from "./chatMessages/chatMessages";
|
|
|
import {
|
|
|
+ actionChatGroupUser,
|
|
|
actionChatGroup,
|
|
|
actionMessage,
|
|
|
actionUsers,
|
|
@@ -13,10 +14,12 @@ import {
|
|
|
} from "./chatGroups/actionChatGroup/actionChatGroup";
|
|
|
import history from "../history";
|
|
|
|
|
|
+var activeMessage = false
|
|
|
+
|
|
|
class MyProfile1 extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
- this.state = { text: ""};
|
|
|
+ this.state = { text: "" };
|
|
|
}
|
|
|
|
|
|
way(obj, resolverName, a) {
|
|
@@ -45,11 +48,8 @@ class MyProfile1 extends Component {
|
|
|
}
|
|
|
|
|
|
componentDidMount() {
|
|
|
- const a = localStorage.getItem("id")
|
|
|
- this.props.chatGroup(a);
|
|
|
- this.props.message();
|
|
|
- // const ar = localStorage.getItem("a");
|
|
|
- // this.props.allMessOneUser("2");
|
|
|
+ const ab = localStorage.getItem("id");
|
|
|
+ this.props.chatGroupUser(ab);
|
|
|
}
|
|
|
|
|
|
render() {
|
|
@@ -81,10 +81,24 @@ class MyProfile1 extends Component {
|
|
|
|
|
|
<div className="chat-groups">
|
|
|
{this.way1("users", "getUser") ||
|
|
|
- this.way("chatGroup", "getAllChatGroupsOneUser", (el) => {
|
|
|
- console.log(el)
|
|
|
+ this.way("chatGroupUser", "getAllChatGroupsOneUser", (el) => {
|
|
|
+ console.log(el);
|
|
|
return (
|
|
|
- <div key={el.id} onClick={() => history.push(`/my_profile/${el.id}`)}>
|
|
|
+ <div
|
|
|
+ key={el.id}
|
|
|
+ onClick={() => {
|
|
|
+ history.push(`/my_profile/${el.id}`);
|
|
|
+ this.props.chatGroup(el.id);
|
|
|
+ this.props.allMessOneUser(el.partnerId.id);
|
|
|
+ activeMessage = true
|
|
|
+ localStorage.setItem(
|
|
|
+ "login",
|
|
|
+ +localStorage.getItem("id") !== el.autorId.id
|
|
|
+ ? el.autorId.login
|
|
|
+ : el.partnerId.login
|
|
|
+ );
|
|
|
+ }}
|
|
|
+ >
|
|
|
<ChatGroupsBar
|
|
|
id={el.id}
|
|
|
login={
|
|
@@ -100,21 +114,8 @@ class MyProfile1 extends Component {
|
|
|
</div>
|
|
|
|
|
|
<div className="chat-messages">
|
|
|
- <ChatMessage />
|
|
|
- {/* {this.way("allMessOneUser", "getAllMessagesOneUser", (el) => {
|
|
|
- return (
|
|
|
- <div key={el.id} >
|
|
|
- <ChatMessage
|
|
|
- id={el.id}
|
|
|
- // login={
|
|
|
- // +localStorage.getItem("id") !== el.autorId.id
|
|
|
- // ? el.autorId.login
|
|
|
- // : el.partnerId.login
|
|
|
- // }
|
|
|
- />
|
|
|
- </div>
|
|
|
- );
|
|
|
- })} */}
|
|
|
+ {activeMessage === true ? <ChatMessage /> : null}
|
|
|
+ {/* <ChatMessage /> */}
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -129,6 +130,7 @@ const ConnectedChatGroups = connect(
|
|
|
return { state };
|
|
|
},
|
|
|
{
|
|
|
+ chatGroupUser: actionChatGroupUser,
|
|
|
chatGroup: actionChatGroup,
|
|
|
message: actionMessage,
|
|
|
users: actionUsers,
|