]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/components/protocol/Item.js
application admin UI
[alttp.git] / resources / js / components / protocol / Item.js
index 74bfa50039cf82ab62c3395d2e2683d2ec1072df..9fcc7e5c6e09b539b837a2056513714dae8af359 100644 (file)
@@ -7,6 +7,7 @@ import { Trans, withTranslation } from 'react-i18next';
 import Icon from '../common/Icon';
 import Spoiler from '../common/Spoiler';
 import { formatTime } from '../../helpers/Result';
+import { getUserName } from '../../helpers/User';
 import i18n from '../../i18n';
 
 const getEntryDate = entry => {
@@ -16,6 +17,11 @@ const getEntryDate = entry => {
                : dateStr;
 };
 
+const getEntryDetailsUsername = entry => {
+       if (!entry || !entry.details || !entry.details.user) return 'Anonymous';
+       return getUserName(entry.details.user);
+};
+
 const getEntryRoundNumber = entry =>
        (entry && entry.details && entry.details.round && entry.details.round.number) || '?';
 
@@ -28,6 +34,16 @@ const getEntryResultTime = entry => {
 
 const getEntryDescription = entry => {
        switch (entry.type) {
+               case 'application.accepted':
+               case 'application.received':
+               case 'application.rejected':
+                       return i18n.t(
+                               `protocol.description.${entry.type}`,
+                               {
+                                       ...entry,
+                                       username: getEntryDetailsUsername(entry),
+                               },
+                       );
                case 'result.report': {
                        const time = getEntryResultTime(entry);
                        return <Trans i18nKey={`protocol.description.${entry.type}`}>