|
|
|
@ -1,20 +1,21 @@ |
|
|
|
|
import React, { Component } from 'react'; |
|
|
|
|
import ReactAudioPlayer from 'react-audio-player'; |
|
|
|
|
import ReactPlayer from 'react-player'; |
|
|
|
|
import CloudDownloadIcon from '@material-ui/icons/CloudDownload'; |
|
|
|
|
|
|
|
|
|
import './Message.scss'; |
|
|
|
|
|
|
|
|
|
export default class Message extends Component { |
|
|
|
|
|
|
|
|
|
render(){ |
|
|
|
|
const {message, user1, user2,file} = this.props; |
|
|
|
|
const {message, user1, user2,file,document} = this.props; |
|
|
|
|
return ( |
|
|
|
|
<div
|
|
|
|
|
className="message d-flex flex-column d-flex" |
|
|
|
|
style={{
|
|
|
|
|
marginRight: message.user.id === user1.id ? 0 : 40, |
|
|
|
|
marginLeft: message.user.id === user1.id ? 40 : 0, |
|
|
|
|
filter: file !== null ? 'blur(16px)': 'blur(0px)', |
|
|
|
|
filter: document !== null ? 'blur(16px)': 'blur(0px)', |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
<img
|
|
|
|
@ -23,24 +24,28 @@ export default class Message extends Component { |
|
|
|
|
alt={message.id} |
|
|
|
|
/> |
|
|
|
|
<div
|
|
|
|
|
className="message__box d-flex" |
|
|
|
|
className={message.voice === null && message.video === null && message.image === null && message.music === null && message.document === null ? `message__box d-flex` : `message__box d-flex message__box--file`} |
|
|
|
|
style={{backgroundColor: message.user.id === user1.id ? "rgb(15, 93, 190)" : "white" }} |
|
|
|
|
> |
|
|
|
|
<div
|
|
|
|
|
className="message__box--detail" |
|
|
|
|
style={{ |
|
|
|
|
right : message.user.id === user1.id ? "auto" : 20 , |
|
|
|
|
left : message.user.id === user1.id ? 20 : "auto" |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
<span |
|
|
|
|
style={{color: message.user.id === user1.id ? "white" : "black" }} |
|
|
|
|
> |
|
|
|
|
{message.user.name} |
|
|
|
|
</span> |
|
|
|
|
</div> |
|
|
|
|
{ |
|
|
|
|
message.text !== null && message.video === null && message.image === null && message.music === null ?
|
|
|
|
|
message.voice === null && message.video === null && message.image === null && message.music === null && message.document === null ? |
|
|
|
|
<div
|
|
|
|
|
className="message__box--detail" |
|
|
|
|
style={{ |
|
|
|
|
right : message.user.id === user1.id ? "auto" : 20 , |
|
|
|
|
left : message.user.id === user1.id ? 20 : "auto" |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
<span |
|
|
|
|
style={{color: message.user.id === user1.id ? "white" : "black" }} |
|
|
|
|
> |
|
|
|
|
{message.user.name} |
|
|
|
|
</span> |
|
|
|
|
</div> : null |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
message.text !== null && message.video === null && message.image === null && message.music === null && message.document === null ?
|
|
|
|
|
<p id="3" style={{color: message.user.id === user1.id ? "white" : "black" }}>{message.text}</p> : null |
|
|
|
|
} |
|
|
|
|
{ |
|
|
|
@ -74,7 +79,21 @@ export default class Message extends Component { |
|
|
|
|
src={message.music} |
|
|
|
|
controls |
|
|
|
|
/> : null |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
{ |
|
|
|
|
message.document !== null ?
|
|
|
|
|
<a
|
|
|
|
|
href={message.document.data}
|
|
|
|
|
download |
|
|
|
|
className="message__box--document d-flex" |
|
|
|
|
style={{ |
|
|
|
|
backgroundColor: message.user.id === user1.id ? "rgb(15, 93, 190)" : "white", |
|
|
|
|
color: message.user.id === user1.id ? "white" : "black" |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
<CloudDownloadIcon style={{color : message.user.id === user1.id ? "white" : "black" , width : 32, height : 32, marginRight: 10}} /> |
|
|
|
|
<div>{message.document.name}</div> |
|
|
|
|
</a> : null |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|