Skip to content

Commit

Permalink
nit: remove unnecessary condition from disable
Browse files Browse the repository at this point in the history
  • Loading branch information
koflaher committed Aug 3, 2023
1 parent a7f14ed commit 0a0d0b6
Showing 1 changed file with 24 additions and 27 deletions.
51 changes: 24 additions & 27 deletions src/components/data_submission/consent_group/EditConsentGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export const EditConsentGroup = (props) => {
validation,
onValidationChange,
idx,
studyEditMode,
dacs,
} = props;

Expand Down Expand Up @@ -113,7 +112,7 @@ export const EditConsentGroup = (props) => {
title: 'Consent Group Name',
validators: [FormValidators.REQUIRED],
placeholder: 'Enter name',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: consentGroup.consentGroupName,
onChange,
validation: validation.consentGroupName,
Expand All @@ -130,7 +129,7 @@ export const EditConsentGroup = (props) => {
name: 'primaryConsent',
value: 'generalResearchUse',
toggleText: 'General Research Use',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: selectedPrimaryGroup(consentGroup),
onChange: ({ value }) => {
onPrimaryChange({ key: value, value: true });
Expand All @@ -148,7 +147,7 @@ export const EditConsentGroup = (props) => {
name: 'primaryConsent',
value: 'hmb',
toggleText: 'Health/Medical/Biomedical Research Use',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: selectedPrimaryGroup(consentGroup),
onChange: ({ value }) => {
onPrimaryChange({ key: value, value: true });
Expand All @@ -165,7 +164,7 @@ export const EditConsentGroup = (props) => {
name: 'primaryConsent',
value: 'diseaseSpecificUse',
toggleText: 'Disease-Specific Research Use',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: selectedPrimaryGroup(consentGroup),
validation: validation.primaryConsent,
onValidationChange: ({ validation }) => {
Expand Down Expand Up @@ -196,7 +195,7 @@ export const EditConsentGroup = (props) => {
name: 'diseaseSpecificUse',
validators: [FormValidators.REQUIRED],
placeholder: 'Please enter one or more diseases',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: selectedDiseases,
validation: validation.diseaseSpecificUse,
onValidationChange: ({ validation }) => {
Expand All @@ -219,7 +218,7 @@ export const EditConsentGroup = (props) => {
name: 'primaryConsent',
value: 'poa',
toggleText: 'Populations, Origins, Ancestry Use',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: selectedPrimaryGroup(consentGroup),
onChange: ({ value }) => {
onPrimaryChange({ key: value, value: true });
Expand All @@ -236,7 +235,7 @@ export const EditConsentGroup = (props) => {
name: 'primaryConsent',
value: 'openAccess',
toggleText: 'No Restrictions (Open Access Data)',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: selectedPrimaryGroup(consentGroup),
onChange: ({ value }) => {
onPrimaryChange({ key: value, value: true });
Expand All @@ -253,7 +252,7 @@ export const EditConsentGroup = (props) => {
name: 'primaryConsent',
value: 'otherPrimary',
toggleText: 'Other',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: selectedPrimaryGroup(consentGroup),
onChange: ({ value }) => {
onPrimaryChange({ key: value, value: otherPrimaryText });
Expand All @@ -270,7 +269,7 @@ export const EditConsentGroup = (props) => {
name: 'otherPrimary',
validators: [FormValidators.REQUIRED],
placeholder: 'Please specify',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: otherPrimaryText,
onChange: ({ key, value, isValid }) => {
setOtherPrimaryText(value);
Expand All @@ -294,7 +293,7 @@ export const EditConsentGroup = (props) => {
name: 'nmds',
type: FormFieldTypes.CHECKBOX,
toggleText: 'No methods development or validation studies (NMDS)',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: consentGroup.nmds,
onChange,
validation: validation.nmds,
Expand All @@ -317,7 +316,7 @@ export const EditConsentGroup = (props) => {
name: 'pub',
type: FormFieldTypes.CHECKBOX,
toggleText: 'Publication Required (PUB)',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: consentGroup.pub,
onChange,
validation: validation.pub,
Expand All @@ -329,7 +328,7 @@ export const EditConsentGroup = (props) => {
name: 'col',
type: FormFieldTypes.CHECKBOX,
toggleText: 'Collaboration Required (COL)',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: consentGroup.col,
onChange,
validation: validation.col,
Expand All @@ -341,7 +340,7 @@ export const EditConsentGroup = (props) => {
name: 'irb',
type: FormFieldTypes.CHECKBOX,
toggleText: 'Ethics Approval Required (IRB)',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: consentGroup.irb,
onChange,
validation: validation.irb,
Expand All @@ -353,7 +352,7 @@ export const EditConsentGroup = (props) => {
name: 'gs',
type: FormFieldTypes.CHECKBOX,
toggleText: 'Geographic Restriction (GS-)',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: showGSText,
onChange: ({ key, value }) => {
setShowGSText(value);
Expand All @@ -372,7 +371,7 @@ export const EditConsentGroup = (props) => {
name: 'gs',
validators: [FormValidators.REQUIRED],
placeholder: 'Specify Geographic Restriction',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: gsText || '',
onChange: ({ key, value, isValid }) => {
setGSText(value);
Expand All @@ -387,7 +386,7 @@ export const EditConsentGroup = (props) => {
name: 'mor',
type: FormFieldTypes.CHECKBOX,
toggleText: 'Publication Moratorium (MOR)',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: showMORText,
onChange: ({ key, value }) => {
setShowMORText(value);
Expand All @@ -401,7 +400,7 @@ export const EditConsentGroup = (props) => {
name: 'mor',
validators: [FormValidators.REQUIRED, FormValidators.DATE],
placeholder: 'Please specify date (YYYY-MM-DD)',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: morText,
onChange: ({ key, value, isValid }) => {
setMORText(value);
Expand All @@ -416,7 +415,7 @@ export const EditConsentGroup = (props) => {
name: 'npu',
type: FormFieldTypes.CHECKBOX,
toggleText: 'Non-profit Use Only (NPU)',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: consentGroup.npu,
onChange,
validation: validation.npu,
Expand All @@ -428,7 +427,7 @@ export const EditConsentGroup = (props) => {
name: 'otherSecondary',
type: FormFieldTypes.CHECKBOX,
toggleText: 'Other',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: showOtherSecondaryText,
onChange: ({ key, value }) => {
setShowOtherSecondaryText(value);
Expand All @@ -447,7 +446,7 @@ export const EditConsentGroup = (props) => {
name: 'otherSecondary',
validators: [FormValidators.REQUIRED],
placeholder: 'Please specify',
disabled: studyEditMode ? disableFields : false,
disabled: disableFields,
defaultValue: otherSecondaryText || '',
onChange: ({ key, value, isValid }) => {
setOtherSecondaryText(value);
Expand All @@ -474,12 +473,10 @@ export const EditConsentGroup = (props) => {
},
validators: [FormValidators.REQUIRED],
validation: validation.dataAccessCommitteeId,
disabled: studyEditMode ? disableFields : false,
defaultValue: studyEditMode ?
consentGroup.dataAccessCommitteeId?.name
: dacs.map((dac) => {
return { dacId: dac.dacId, displayText: dac.name };
}).find((dac) => dac.dacId === consentGroup.dataAccessCommitteeId),
disabled: disableFields,
defaultValue: dacs.map((dac) => {
return { dacId: dac.dacId, displayText: dac.name };
}).find((dac) => dac.dacId === consentGroup.dataAccessCommitteeId),
onValidationChange,
}),
]),
Expand Down

0 comments on commit 0a0d0b6

Please sign in to comment.