X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Fusers%2FBox.js;h=c0d011bc106d4060dcbfd222865b62ed3d1e2fad;hb=5dc7faa01ad96732b0ea126e945f215a9d0490af;hp=139e6f65573081dda97849ead6a0681b5ae292b4;hpb=edd0e97bfdc544114f30bf4c13a929631c44a555;p=alttp.git
diff --git a/resources/js/components/users/Box.js b/resources/js/components/users/Box.js
index 139e6f6..c0d011b 100644
--- a/resources/js/components/users/Box.js
+++ b/resources/js/components/users/Box.js
@@ -1,26 +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 = ({ user }) => user ?
-
+const Box = ({ discriminator, noLink, user }) => {
+ const navigate = useNavigate();
+
+ if (!user) {
+ return {i18n.t('general.anonymous')};
+ }
+
+ const content = <>
- {user.username}
-
- {'#'}
- {user.discriminator}
-
-
-:
- {i18n.t('general.anonymous')}
-;
+ {discriminator ? user.username : getUserName(user)}
+ {discriminator && user.discriminator && user.discriminator !== '0' ?
+
+ {'#'}
+ {user.discriminator}
+
+ : null}
+ >;
+
+ 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,
}),
};