|
|
|
@ -6,7 +6,8 @@ import { RecordState } from 'audio-react-recorder'; |
|
|
|
|
import ReactPlayer from 'react-player'; |
|
|
|
|
import ReactAudioPlayer from 'react-audio-player'; |
|
|
|
|
import { ToastContainer } from 'react-toastify'; |
|
|
|
|
|
|
|
|
|
import photo from '../../../assets/images/reza.png'; |
|
|
|
|
import photo1 from '../../../assets/images/user2.png'; |
|
|
|
|
import './Body.scss'; |
|
|
|
|
import { list, send, sendKeys } from '../../../Redux/actions/message'; |
|
|
|
|
import { info, bio } from '../../../Redux/actions/chat'; |
|
|
|
@ -342,15 +343,12 @@ class Body extends Component { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
|
const { setPage, chatInfo, messageList, userId } = this.props; |
|
|
|
|
const userIdx = {}; |
|
|
|
|
chatInfo.users.map((e) => (userIdx[e.id] = e)); |
|
|
|
|
console.log({ userId }); |
|
|
|
|
const { setPage } = this.props; |
|
|
|
|
return ( |
|
|
|
|
<div className="chat-body d-flex flex-column"> |
|
|
|
|
<div className="chat-room__status d-flex flex-column" onClick={() => setPage('info')}> |
|
|
|
|
<h1>{chatInfo.title}</h1> |
|
|
|
|
<p>{chatInfo.subtitle}</p> |
|
|
|
|
<h1>{this.props.info.title}</h1> |
|
|
|
|
<p>{this.props.info.subtitle}</p> |
|
|
|
|
</div> |
|
|
|
|
<div |
|
|
|
|
className="chat-body__content d-flex flex-column" |
|
|
|
@ -361,18 +359,15 @@ class Body extends Component { |
|
|
|
|
paddingBottom: this.state.footer === 'suggest' ? 110 : 70, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
{chatInfo.users && |
|
|
|
|
messageList.map((item, i) => |
|
|
|
|
this.state.image === null && |
|
|
|
|
this.state.music === null && |
|
|
|
|
this.state.video === null ? ( |
|
|
|
|
{this.props.message_list.map((item, i) => |
|
|
|
|
this.state.image === null && this.state.music === null && this.state.video === null ? ( |
|
|
|
|
<Message |
|
|
|
|
isSelf={userId == item.userId} |
|
|
|
|
isSelf={this.props.userId == item.userId} |
|
|
|
|
key={i} |
|
|
|
|
file={this.state.image} |
|
|
|
|
document={this.state.document} |
|
|
|
|
message={item} |
|
|
|
|
user={userIdx[item.userId] || { id: 0, fileId: 0, name: 'null' }} |
|
|
|
|
user={this.props.info.users[item.userId]} |
|
|
|
|
/> |
|
|
|
|
) : null |
|
|
|
|
)} |
|
|
|
@ -440,13 +435,10 @@ class Body extends Component { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
export default connect( |
|
|
|
|
(state) => { |
|
|
|
|
console.log(state); |
|
|
|
|
return { |
|
|
|
|
chatInfo: state.chat.info, |
|
|
|
|
userId: state.user.isLogin.id, |
|
|
|
|
messageList: state.message.list || [], |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
(state) => ({ |
|
|
|
|
info: state.chat.info, |
|
|
|
|
userId: state.user.id, |
|
|
|
|
message_list: state.message.list || [], |
|
|
|
|
}), |
|
|
|
|
{ list, send, sendKeys, info, bio } |
|
|
|
|
)(Body); |
|
|
|
|