aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/PM.js
blob: 3aa877b1279d46359fd8aea1c077d28be6d60db9 (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.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
};
*/