]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/components/results/List.js
open tournament type
[alttp.git] / resources / js / components / results / List.js
index 14c70968cd5324823c558732df049e3a2fd715ea..3d1bdfa8f27c9ff0147832934ce81975a8bee2c0 100644 (file)
@@ -8,6 +8,19 @@ import { getRunners } from '../../helpers/Tournament';
 import { withUser } from '../../helpers/UserContext';
 
 const List = ({ round, tournament, user }) => {
+       if (tournament.type === 'open-async') {
+               const results = round.results || [];
+               return <div className="results d-flex flex-wrap">
+                       {results.map(result =>
+                               <Item
+                                       key={result.id}
+                                       round={round}
+                                       tournament={tournament}
+                                       user={result.user}
+                               />
+                       )}
+               </div>;
+       }
        const runners = maySeeResults(user, tournament, round)
                ? sortByResult(getRunners(tournament), round)
                : sortByFinished(getRunners(tournament), round);
@@ -15,9 +28,9 @@ const List = ({ round, tournament, user }) => {
                {runners.map(participant =>
                        <Item
                                key={participant.id}
-                               participant={participant}
                                round={round}
                                tournament={tournament}
+                               user={participant.user}
                        />
                )}
        </div>;
@@ -25,10 +38,15 @@ const List = ({ round, tournament, user }) => {
 
 List.propTypes = {
        round: PropTypes.shape({
+               results: PropTypes.arrayOf(PropTypes.shape({
+               })),
        }),
        tournament: PropTypes.shape({
                participants: PropTypes.arrayOf(PropTypes.shape({
                })),
+               type: PropTypes.string,
+               users: PropTypes.arrayOf(PropTypes.shape({
+               })),
        }),
        user: PropTypes.shape({
        }),