import Icon from '../common/Icon';
import { isApplicant, isDeniedApplicant, isRunner, mayApply } from '../../helpers/permissions';
-import { withUser } from '../../helpers/UserContext';
+import { useUser } from '../../hooks/user';
import i18n from '../../i18n';
const apply = async tournament => {
return i18n.t('tournaments.apply');
};
-const ApplyButton = ({ tournament, user }) => {
- if (!tournament.accept_applications || isRunner(user, tournament)) return null;
+const ApplyButton = ({ tournament }) => {
+ const { user } = useUser();
+
+ if (!user || !tournament.accept_applications || isRunner(user, tournament)) return null;
return <span className="d-inline-block" title={getTitle(user, tournament)}>
<Button
accept_applications: PropTypes.bool,
id: PropTypes.number,
}),
- user: PropTypes.shape({
- }),
};
-export default withTranslation()(withUser(ApplyButton));
+export default withTranslation()(ApplyButton);