]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/components/results/DetailDialog.js
open tournament type
[alttp.git] / resources / js / components / results / DetailDialog.js
index 368575bd359013d739e87b9c4ca593e5deff562e..a914f5d0e134926dd5fd47f654795cc45fe6209c 100644 (file)
@@ -5,8 +5,8 @@ import { withTranslation } from 'react-i18next';
 
 import Box from '../users/Box';
 import { getTime } from '../../helpers/Result';
-import { findResult } from '../../helpers/Participant';
 import { maySeeResults } from '../../helpers/permissions';
+import { findResult } from '../../helpers/User';
 import { withUser } from '../../helpers/UserContext';
 import i18n from '../../i18n';
 
@@ -14,15 +14,15 @@ const getPlacement = result =>
        `${result.placement}. (${i18n.t('results.points', { count: result.score })})`;
 
 const DetailDialog = ({
+       authUser,
        onHide,
-       participant,
        round,
        show,
        tournament,
        user,
 }) => {
-       const result = findResult(participant, round);
-       const maySee = maySeeResults(user, tournament, round);
+       const result = findResult(user, round);
+       const maySee = maySeeResults(authUser, tournament, round);
        return <Modal className="result-dialog" onHide={onHide} show={show}>
                <Modal.Header closeButton>
                        <Modal.Title>
@@ -41,7 +41,7 @@ const DetailDialog = ({
                                </Form.Group>
                                <Form.Group as={Col} sm={6}>
                                        <Form.Label>{i18n.t('results.runner')}</Form.Label>
-                                       <div><Box user={participant.user} /></div>
+                                       <div><Box user={user} /></div>
                                </Form.Group>
                                <Form.Group as={Col} sm={6}>
                                        <Form.Label>{i18n.t('results.result')}</Form.Label>
@@ -76,11 +76,9 @@ const DetailDialog = ({
 };
 
 DetailDialog.propTypes = {
-       onHide: PropTypes.func,
-       participant: PropTypes.shape({
-               user: PropTypes.shape({
-               }),
+       authUser: PropTypes.shape({
        }),
+       onHide: PropTypes.func,
        round: PropTypes.shape({
                created_at: PropTypes.string,
                number: PropTypes.number,
@@ -92,4 +90,4 @@ DetailDialog.propTypes = {
        }),
 };
 
-export default withTranslation()(withUser(DetailDialog));
+export default withTranslation()(withUser(DetailDialog, 'authUser'));