X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Ftournament%2FApplyButton.js;h=8bbd98ec12556daf57572178e50781c615896a84;hb=4c5a82cb876e96c72c50e8bc12bd8a43a9afe847;hp=bd944c903d53556595b3d3ebb8600f1d74d1aa2b;hpb=3a774bb649734fc3a2135ec1b52cef9a049880ee;p=alttp.git diff --git a/resources/js/components/tournament/ApplyButton.js b/resources/js/components/tournament/ApplyButton.js index bd944c9..8bbd98e 100644 --- a/resources/js/components/tournament/ApplyButton.js +++ b/resources/js/components/tournament/ApplyButton.js @@ -6,8 +6,8 @@ import { withTranslation } from 'react-i18next'; import toastr from 'toastr'; import Icon from '../common/Icon'; -import { isApplicant, isDeniedApplicant, mayApply } from '../../helpers/permissions'; -import { withUser } from '../../helpers/UserContext'; +import { isApplicant, isDeniedApplicant, isRunner, mayApply } from '../../helpers/permissions'; +import { useUser } from '../../hooks/user'; import i18n from '../../i18n'; const apply = async tournament => { @@ -29,8 +29,10 @@ const getTitle = (user, tournament) => { return i18n.t('tournaments.apply'); }; -const ApplyButton = ({ tournament, user }) => { - if (!tournament.accept_applications) return null; +const ApplyButton = ({ tournament }) => { + const { user } = useUser(); + + if (!user || !tournament.accept_applications || isRunner(user, tournament)) return null; return