From 2e71b6d1a0a41e909f787869b05b80e3fab76c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chif=20Gerg=C5=91?= <chifgeri97@gmail.com> Date: Sat, 2 Feb 2019 19:17:50 +0100 Subject: [PATCH] Remove checkbox from profile if user isnt Applicant --- src/components/pages/Profile.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/components/pages/Profile.js b/src/components/pages/Profile.js index fead120..5f8b3c7 100644 --- a/src/components/pages/Profile.js +++ b/src/components/pages/Profile.js @@ -20,7 +20,7 @@ class Profile extends Component { render() { const { - nick, groups, motivationAbout, motivationProfession, motivationExercise, signed, id, + role, nick, groups, motivationAbout, motivationProfession, motivationExercise, signed, id, } = this.props; return ( <Container @@ -106,14 +106,18 @@ class Profile extends Component { defaultValue={groups} /> <br /> - <Form.Checkbox - name='signed' - label='SzeretnĂŠk jelentkezni a KSZKĂŠpzĂŠsre' - onChange={(_, v) => - this.props.textChange({ target: { name: v.name, value: v.checked } }) - } - checked={signed} - /> + { role === 'Applicant' ? + <Form.Checkbox + name='signed' + label='SzeretnĂŠk jelentkezni a KSZKĂŠpzĂŠsre' + onChange={(_, v) => + this.props.textChange({ target: { name: v.name, value: v.checked } }) + } + checked={signed} + /> + : + null + } <Form.Button primary onClick={() => this.props.submitRegistration({ @@ -130,9 +134,10 @@ class Profile extends Component { const mapStateToProps = ({ user: { - nick, groups, motivationAbout, motivationProfession, motivationExercise, signed, id, + role, nick, groups, motivationAbout, motivationProfession, motivationExercise, signed, id, }, }) => ({ + role, nick, groups, motivationAbout, -- GitLab