1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { Button } from 'react-bootstrap';
4 import { withTranslation } from 'react-i18next';
5 import { useNavigate } from 'react-router-dom';
7 import { getAvatarUrl, getUserName } from '../../helpers/User';
8 import i18n from '../../i18n';
10 const Box = ({ discriminator, noLink, user }) => {
11 const navigate = useNavigate();
14 return <span>{i18n.t('general.anonymous')}</span>;
18 <img alt="" src={getAvatarUrl(user)} />
19 <span>{discriminator ? user.username : getUserName(user)}</span>
20 {discriminator && user.discriminator && user.discriminator !== '0' ?
21 <span className="text-muted">
29 return <span className="user-box">{content}</span>;
34 onClick={() => navigate(`/users/${user.id}`)}
42 discriminator: PropTypes.bool,
43 noLink: PropTypes.bool,
44 user: PropTypes.shape({
45 discriminator: PropTypes.string,
47 nickname: PropTypes.string,
48 username: PropTypes.string,
52 export default withTranslation()(Box);