aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/PM.js
blob: b0426ea30a9e82730b49c3659e0324fac943f18e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { memo } from 'react'

import Avatar from './Avatar'
import { format } from '../utils/embed'
import { chatItemStyle } from './helpers/BubbleStyle'
import { useVisitor } from './VisitorContext'

function PM(props) {
    const { chat } = props
    const [visitor] = useVisitor()
    return (
        <li>
            <div style={chatItemStyle(visitor, chat)}>
                <Avatar user={chat.user} />
                <div className={visitor && visitor.uid === chat.user.uid ? 'msg-bubble msg-bubble-my' : 'msg-bubble'}>
                    <p dangerouslySetInnerHTML={{ __html: format(chat.body, '0', false) }} />
                </div>
            </div>
        </li>
    )
}

export default memo(PM)
/*
PM.propTypes = {
    chat: MessageType.isRequired
};
*/