Skip to content

Commit

Permalink
clarify disabled value
Browse files Browse the repository at this point in the history
  • Loading branch information
Maftalion committed Mar 23, 2021
1 parent 4ab86c8 commit a193424
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pages/settings/ProfilePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,17 @@ class ProfilePage extends Component {
}

render() {
// Determines if the pronouns/selected pronouns have changed
const arePronounsUnchanged = this.props.myPersonalDetails.pronouns === this.state.pronouns
|| (this.props.myPersonalDetails.pronouns
&& this.props.myPersonalDetails.pronouns === this.state.selfSelectedPronouns);

// Disables button if none of the form values have changed
const isButtonDisabled = (this.props.myPersonalDetails.firstName === this.state.firstName)
&& (this.props.myPersonalDetails.lastName === this.state.lastName)
&& (this.props.myPersonalDetails.timezone.selected === this.state.selectedTimezone)
&& (this.props.myPersonalDetails.timezone.automatic === this.state.isAutomaticTimezone)
&& (this.props.myPersonalDetails.pronouns === this.state.pronouns
|| (this.props.myPersonalDetails.pronouns
&& this.props.myPersonalDetails.pronouns === this.state.selfSelectedPronouns));
&& arePronounsUnchanged;

return (
<ScreenWrapper>
Expand Down

0 comments on commit a193424

Please sign in to comment.