diff options
author | 2018-08-31 14:45:14 +0300 | |
---|---|---|
committer | 2023-01-13 10:37:53 +0300 | |
commit | 35c009b9e33a94009e43ee261a14037aec4cac10 (patch) | |
tree | 62117c4967b15ee73e8938a50c0444a7aecb3ffd /vnext/src/components/UserInfo.js | |
parent | 8c65a5222b9ad1f502df39e2576b361c45fab577 (diff) |
layout refresh
Diffstat (limited to 'vnext/src/components/UserInfo.js')
-rw-r--r-- | vnext/src/components/UserInfo.js | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/vnext/src/components/UserInfo.js b/vnext/src/components/UserInfo.js new file mode 100644 index 00000000..147bb6f8 --- /dev/null +++ b/vnext/src/components/UserInfo.js @@ -0,0 +1,85 @@ +import React from 'react'; + +import { Link } from 'react-router-dom'; + +import { info } from '../api'; + +import Avatar from './Avatar'; +import Icon from './Icon'; +import SearchBox from './SearchBox'; + +export default class UserInfo extends React.Component { + constructor(props) { + super(props); + this.state = { + user: { uname: props.user, uid: 0 } + }; + } + componentDidMount() { + info(this.state.user.uname).then(response => { + this.setState({ + user: response.data[0] + }); + }); + } + render() { + const { user } = this.state; + return ( + <div style={{ padding: '14px' }}> + <Avatar user={user}> + <div className="msg-ts">Was online recently</div> + </Avatar> + <div> + { + user.uid > 0 && + <> + <ul> + <li> + <Link to="/pm"> + <Icon name="ei-envelope" size="s" />PM + </Link> + </li> + <li> + <Link to={`/${user.uname}/?show=recomm`} rel="nofollow"> + <Icon name="ei-heart" size="s" />Recommendations + </Link> + </li> + <li> + <Link to={`/${user.uname}/?media=1`} rel="nofollow"> + <Icon name="ei-camera" size="s" />Photos + </Link> + </li> + </ul> + <hr /> + <SearchBox pathname={`/${user.uname}/`} onSearch={this.search} {...this.props} /> + <hr /> + <div id="ustats"> + <ul> + { + user.read && + <li><Link to={`/${user.uname}/friends`}>I read: {user.read.length}</Link></li> + } + <li><Link to={`/${user.uname}/readers`}>My readers: {user.readers ? user.readers.length : 0}</Link></li> + { + user.statsMyBL && + <li><Link to={`/${user.uname}/bl`}>My blacklist: {user.statsMyBL}</Link></li> + } + <li>Messages: {user.statsMessages}</li> + <li>Comments: {user.statsReplies}</li> + </ul> + { + user.read && + <div className="iread"> + { + user.read.map(u => <Avatar user={u} key={u.uid} />) + } + </div> + } + </div> + </> + } + </div> + </div> + ); + } +}
\ No newline at end of file |