summaryrefslogtreecommitdiffstats
path: root/web/react/components/post_header.jsx
blob: c2cadb7427e463a1d0f8ff766df62ba73f4abaeb (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.

var UserProfile = require('./user_profile.jsx');
var PostInfo = require('./post_info.jsx');

export default class PostHeader extends React.Component {
    constructor(props) {
        super(props);
        this.state = {};
    }
    render() {
        var post = this.props.post;

        let userProfile = <UserProfile userId={post.user_id} />;
        if (post.props && post.props.override_username) {
            userProfile = (
                <UserProfile
                    userId={post.user_id}
                    overwriteName={post.props.override_username}
                    disablePopover={true}
                />
            );
        }

        return (
            <ul className='post-header post-header-post'>
                <li className='post-header-col post-header__name'><strong>{userProfile}</strong></li>
                <li className='post-info--hidden'>
                    <PostInfo
                        post={post}
                        commentCount={this.props.commentCount}
                        handleCommentClick={this.props.handleCommentClick}
                        allowReply='true'
                        isLastComment={this.props.isLastComment}
                    />
                </li>
            </ul>
        );
    }
}

PostHeader.defaultProps = {
    post: null,
    commentCount: 0,
    isLastComment: false
};
PostHeader.propTypes = {
    post: React.PropTypes.object,
    commentCount: React.PropTypes.number,
    isLastComment: React.PropTypes.bool,
    handleCommentClick: React.PropTypes.func
};