X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=resources%2Fjs%2Fcomponents%2Fresults%2FList.js;h=911b6a53ba5526a70cb9073963190e6d0883949e;hb=a1f2759cc827baaa49f1869b88f676d4dc39bf10;hp=3d1bdfa8f27c9ff0147832934ce81975a8bee2c0;hpb=537b998e8059c56e3a20ee2a89d42c3bbfbb80b8;p=alttp.git diff --git a/resources/js/components/results/List.js b/resources/js/components/results/List.js index 3d1bdfa..911b6a5 100644 --- a/resources/js/components/results/List.js +++ b/resources/js/components/results/List.js @@ -5,11 +5,16 @@ 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'; +import { compareResult } from '../../helpers/Result'; +import { useUser } from '../../hooks/user'; + +const List = ({ round, tournament }) => { + const { user } = useUser(); -const List = ({ round, tournament, user }) => { if (tournament.type === 'open-async') { - const results = round.results || []; + const results = maySeeResults(user, tournament, round) + ? (round.results || []).sort(compareResult) + : round.results || []; return