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 <div className="results d-flex flex-wrap">
{results.map(result =>
<Item
users: PropTypes.arrayOf(PropTypes.shape({
})),
}),
- user: PropTypes.shape({
- }),
};
-export default withUser(List);
+export default List;