X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Fresults%2FList.js;h=14c70968cd5324823c558732df049e3a2fd715ea;hb=8d97d023740e438361e659c6e133418e33343178;hp=11eb9a8f4f5eb1f07b7aaa7a13efb431de0923ec;hpb=edd0e97bfdc544114f30bf4c13a929631c44a555;p=alttp.git diff --git a/resources/js/components/results/List.js b/resources/js/components/results/List.js index 11eb9a8..14c7096 100644 --- a/resources/js/components/results/List.js +++ b/resources/js/components/results/List.js @@ -2,17 +2,26 @@ import PropTypes from 'prop-types'; import React from 'react'; import Item from './Item'; +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 }) =>
- {tournament.participants.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({ @@ -21,6 +30,8 @@ List.propTypes = { participants: PropTypes.arrayOf(PropTypes.shape({ })), }), + user: PropTypes.shape({ + }), }; -export default List; +export default withUser(List);