import React from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; import { UserType } from './Types'; 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 (
Was online recently
{ user.uid > 0 && <>
    { user.read &&
  • I read: {user.read.length}
  • }
  • My readers: {user.readers ? user.readers.length : 0}
  • { user.statsMyBL &&
  • My blacklist: {user.statsMyBL}
  • }
  • Messages: {user.statsMessages}
  • Comments: {user.statsReplies}
{ user.read &&
{ user.read.map(u => ) }
}
}
); } } UserInfo.propTypes = { user: PropTypes.string.isRequired };