X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Ftournament%2FApplyButton.js;h=8bbd98ec12556daf57572178e50781c615896a84;hb=04af60ad0cd937639cf5e1a0a8d023d9c1eea152;hp=a6bde2f7ac5e622e4321d6056c83f0f4802aab9d;hpb=879e02084f2a9a9e049d9b3de8bcc7e30d9c999a;p=alttp.git diff --git a/resources/js/components/tournament/ApplyButton.js b/resources/js/components/tournament/ApplyButton.js index a6bde2f..8bbd98e 100644 --- a/resources/js/components/tournament/ApplyButton.js +++ b/resources/js/components/tournament/ApplyButton.js @@ -7,7 +7,7 @@ import toastr from 'toastr'; 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 => { @@ -29,7 +29,9 @@ const getTitle = (user, tournament) => { return i18n.t('tournaments.apply'); }; -const ApplyButton = ({ tournament, user }) => { +const ApplyButton = ({ tournament }) => { + const { user } = useUser(); + if (!user || !tournament.accept_applications || isRunner(user, tournament)) return null; return @@ -48,8 +50,6 @@ ApplyButton.propTypes = { accept_applications: PropTypes.bool, id: PropTypes.number, }), - user: PropTypes.shape({ - }), }; -export default withTranslation()(withUser(ApplyButton)); +export default withTranslation()(ApplyButton);