X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Fresults%2FList.js;h=14c70968cd5324823c558732df049e3a2fd715ea;hb=855decfd62b51ed500c8a5903f4b263c4c9afb5c;hp=f4d4ff10ee502130f44f65a9e03762347100d692;hpb=a748d5724c8acff6e3bb3fe6c20aa5968b65d58a;p=alttp.git diff --git a/resources/js/components/results/List.js b/resources/js/components/results/List.js index f4d4ff1..14c7096 100644 --- a/resources/js/components/results/List.js +++ b/resources/js/components/results/List.js @@ -2,19 +2,26 @@ import PropTypes from 'prop-types'; import React from 'react'; import Item from './Item'; -import { sortByResult } from '../../helpers/Participant'; +import { sortByFinished, sortByResult } from '../../helpers/Participant'; +import { maySeeResults } from '../../helpers/permissions'; import { getRunners } from '../../helpers/Tournament'; +import { withUser } from '../../helpers/UserContext'; -const List = ({ round, tournament }) =>
- {sortByResult(getRunners(tournament), round).map(participant => - - )} -
; +const List = ({ round, tournament, user }) => { + const runners = maySeeResults(user, tournament, round) + ? sortByResult(getRunners(tournament), round) + : sortByFinished(getRunners(tournament), round); + return
+ {runners.map(participant => + + )} +
; +}; List.propTypes = { round: PropTypes.shape({ @@ -23,6 +30,8 @@ List.propTypes = { participants: PropTypes.arrayOf(PropTypes.shape({ })), }), + user: PropTypes.shape({ + }), }; -export default List; +export default withUser(List);