X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Fusers%2FBox.js;h=c0d011bc106d4060dcbfd222865b62ed3d1e2fad;hb=1557083acedbffeae2cec7deaa485fd8dcdbaa49;hp=7bbc186eaacc54e4e934b8fdef82d2b71aa9b24d;hpb=21cc6fddc58d14a635cafa0add99a39fdbca0e9a;p=alttp.git
diff --git a/resources/js/components/users/Box.js b/resources/js/components/users/Box.js
index 7bbc186..c0d011b 100644
--- a/resources/js/components/users/Box.js
+++ b/resources/js/components/users/Box.js
@@ -1,29 +1,50 @@
import PropTypes from 'prop-types';
import React from 'react';
+import { Button } from 'react-bootstrap';
import { withTranslation } from 'react-i18next';
+import { useNavigate } from 'react-router-dom';
-import { getAvatarUrl } from '../../helpers/User';
+import { getAvatarUrl, getUserName } from '../../helpers/User';
import i18n from '../../i18n';
-const Box = ({ discriminator, user }) => user ?
-
+const Box = ({ discriminator, noLink, user }) => {
+ const navigate = useNavigate();
+
+ if (!user) {
+ return {i18n.t('general.anonymous')};
+ }
+
+ const content = <>
- {user.username}
- {discriminator ?
+ {discriminator ? user.username : getUserName(user)}
+ {discriminator && user.discriminator && user.discriminator !== '0' ?
{'#'}
{user.discriminator}
: null}
-
-:
- {i18n.t('general.anonymous')}
-;
+ >;
+
+ if (noLink) {
+ return {content};
+ }
+
+ return ;
+};
Box.propTypes = {
discriminator: PropTypes.bool,
+ noLink: PropTypes.bool,
user: PropTypes.shape({
discriminator: PropTypes.string,
+ id: PropTypes.string,
+ nickname: PropTypes.string,
username: PropTypes.string,
}),
};