|
@@ -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 { TeamOutlined, FormOutlined, SearchOutlined } from "@ant-design/icons";
|
|
import { connect } from "react-redux";
|
|
import { connect } from "react-redux";
|
|
import "./myProfile.css";
|
|
import "./myProfile.css";
|
|
@@ -6,6 +6,7 @@ import "./myProfile.css";
|
|
import ChatGroupsBar from "./chatGroups/chatGroups";
|
|
import ChatGroupsBar from "./chatGroups/chatGroups";
|
|
import ChatMessage from "./chatMessages/chatMessages";
|
|
import ChatMessage from "./chatMessages/chatMessages";
|
|
import {
|
|
import {
|
|
|
|
+ actionChatGroupUser,
|
|
actionChatGroup,
|
|
actionChatGroup,
|
|
actionMessage,
|
|
actionMessage,
|
|
actionUsers,
|
|
actionUsers,
|
|
@@ -13,10 +14,12 @@ import {
|
|
} from "./chatGroups/actionChatGroup/actionChatGroup";
|
|
} from "./chatGroups/actionChatGroup/actionChatGroup";
|
|
import history from "../history";
|
|
import history from "../history";
|
|
|
|
|
|
|
|
+var activeMessage = false
|
|
|
|
+
|
|
class MyProfile1 extends Component {
|
|
class MyProfile1 extends Component {
|
|
constructor(props) {
|
|
constructor(props) {
|
|
super(props);
|
|
super(props);
|
|
- this.state = { text: ""};
|
|
|
|
|
|
+ this.state = { text: "" };
|
|
}
|
|
}
|
|
|
|
|
|
way(obj, resolverName, a) {
|
|
way(obj, resolverName, a) {
|
|
@@ -45,11 +48,8 @@ class MyProfile1 extends Component {
|
|
}
|
|
}
|
|
|
|
|
|
componentDidMount() {
|
|
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() {
|
|
render() {
|
|
@@ -81,10 +81,24 @@ class MyProfile1 extends Component {
|
|
|
|
|
|
<div className="chat-groups">
|
|
<div className="chat-groups">
|
|
{this.way1("users", "getUser") ||
|
|
{this.way1("users", "getUser") ||
|
|
- this.way("chatGroup", "getAllChatGroupsOneUser", (el) => {
|
|
|
|
- console.log(el)
|
|
|
|
|
|
+ this.way("chatGroupUser", "getAllChatGroupsOneUser", (el) => {
|
|
|
|
+ console.log(el);
|
|
return (
|
|
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
|
|
<ChatGroupsBar
|
|
id={el.id}
|
|
id={el.id}
|
|
login={
|
|
login={
|
|
@@ -100,21 +114,8 @@ class MyProfile1 extends Component {
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div className="chat-messages">
|
|
<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>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -129,6 +130,7 @@ const ConnectedChatGroups = connect(
|
|
return { state };
|
|
return { state };
|
|
},
|
|
},
|
|
{
|
|
{
|
|
|
|
+ chatGroupUser: actionChatGroupUser,
|
|
chatGroup: actionChatGroup,
|
|
chatGroup: actionChatGroup,
|
|
message: actionMessage,
|
|
message: actionMessage,
|
|
users: actionUsers,
|
|
users: actionUsers,
|