import DetailDialog from './DetailDialog';
import Box from '../users/Box';
import { getIcon, getTime } from '../../helpers/Result';
-import { findResult } from '../../helpers/Participant';
import { maySeeResults } from '../../helpers/permissions';
+import { findResult } from '../../helpers/User';
import { withUser } from '../../helpers/UserContext';
const getClassName = result => {
};
const Item = ({
- participant,
+ authUser,
round,
tournament,
user,
}) => {
const [showDialog, setShowDialog] = useState(false);
- const result = findResult(participant, round);
- const maySee = maySeeResults(user, tournament, round);
+ const result = findResult(user, round);
+ const maySee = maySeeResults(authUser, tournament, round);
return <div className="result">
- <Box user={participant.user} />
+ <Box user={user} />
<Button
className={getClassName(result)}
onClick={() => setShowDialog(true)}
</Button>
<DetailDialog
onHide={() => setShowDialog(false)}
- participant={participant}
round={round}
show={showDialog}
tournament={tournament}
+ user={user}
/>
</div>;
};
Item.propTypes = {
- participant: PropTypes.shape({
- user: PropTypes.shape({
- }),
+ authUser: PropTypes.shape({
}),
round: PropTypes.shape({
}),
}),
};
-export default withUser(Item);
+export default withUser(Item, 'authUser');