aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/Contact.js
blob: a0d32e84669096000818d647af87cb6cb740ef16 (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
import { memo } from 'react';

import Avatar from './Avatar';

/**
 * @typedef {object} ContactProps
 * @property {import('../api').Chat} user
 * @property {import('react').CSSProperties} style
 */

/**
 * Contact component
 * 
 * @param {ContactProps} props
 */
function Contact({ user, style }) {
    return (
        <Avatar user={user} link={`/pm/${user.uname}`} style={style}>
            {user.unreadCount && <span className="badge">{user.unreadCount}</span>}
            <div className="msg-ts">{user.lastMessageText}</div>
        </Avatar>
    );
}

export default memo(Contact);