Skip to content

Commit

Permalink
final touches
Browse files Browse the repository at this point in the history
  • Loading branch information
hams7504 committed Sep 6, 2023
1 parent a9cdf34 commit 6ae56a4
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 82 deletions.
92 changes: 45 additions & 47 deletions src/pages/user_profile/AffiliationAndRoles.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,54 +123,52 @@ export default function AffiliationAndRole(props) {
const generateInstitutionSelectionDisplay = () => {
if (!isSigningOfficial() || (isNil(profile.institutionId) && isNil(profile.suggestedInstitution))) {
return <div>
<h>
<FormField
id='institutionId'
type={FormFieldTypes.SELECT}
selectOptions={(institutions).map((i) => {
return {
institutionId: i.id,
displayText: i.name,
};
})}
placeholder='Search for Institution...'
isCreatable={true}
defaultValue={{
institutionId: selectedInstitution?.institutionId,
suggestedInstitution: profile.suggestedInstitution,
displayText: (
(!isNil(selectedInstitution)
? `${selectedInstitution.name}`
: (!isNil(profile.suggestedInstitution)
? `${profile.suggestedInstitution}`
: ''))
),
}}
selectConfig={{
clearValue: () => {
setProfile(Object.assign({},
profile,
{
institutionId: undefined,
suggestedInstitution: undefined
}));
},
}}
onChange={({ value }) => {
if (!isNil(value?.institutionId)) {
setProfile(Object.assign({}, profile, {
institutionId: value?.institutionId,
suggestedInstitution: undefined
}));
} else {
setProfile(Object.assign({}, profile, {
<FormField
id='institutionId'
type={FormFieldTypes.SELECT}
selectOptions={(institutions).map((i) => {
return {
institutionId: i.id,
displayText: i.name,
};
})}
placeholder='Search for Institution...'
isCreatable={true}
defaultValue={{
institutionId: selectedInstitution?.institutionId,
suggestedInstitution: profile.suggestedInstitution,
displayText: (
(!isNil(selectedInstitution)
? `${selectedInstitution.name}`
: (!isNil(profile.suggestedInstitution)
? `${profile.suggestedInstitution}`
: ''))
),
}}
selectConfig={{
clearValue: () => {
setProfile(Object.assign({},
profile,
{
institutionId: undefined,
suggestedInstitution: value?.displayText
suggestedInstitution: undefined
}));
}
}} >
</FormField>
</h>
},
}}
onChange={({ value }) => {
if (!isNil(value?.institutionId)) {
setProfile(Object.assign({}, profile, {
institutionId: value?.institutionId,
suggestedInstitution: undefined
}));
} else {
setProfile(Object.assign({}, profile, {
institutionId: undefined,
suggestedInstitution: value?.displayText
}));
}
}} >
</FormField>
</div>;
} else {
let institution = (profile.institutionId ? find(institutions, { id: profile.institutionId }) : null);
Expand Down Expand Up @@ -227,7 +225,7 @@ export default function AffiliationAndRole(props) {
<Tooltip
title='You cannot edit your institution if you are a signing official already associated with an institution.'
arrow>
<div style={{float: 'right'}}>
<div style={{ float: 'right' }}>
<button
id='btn_submit'
onClick={submitForm}
Expand Down
32 changes: 14 additions & 18 deletions src/pages/user_profile/RequestRole.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,13 @@ export default function RequestRole(props) {
style={{ ...headerStyle, marginTop: 0 }}>
Which of the following are you looking to do?*
</h2>
{possibleSupportRequests.map((i, supportRequest) => {
return <h key={i}>
<FormField
toggleText={supportRequest.label}
type={FormFieldTypes.CHECKBOX}
key={supportRequest.key}
id={supportRequest.key}
onChange={handleSupportRequestsChange} />
</h>;
{possibleSupportRequests.map((supportRequest) => {
return <FormField
toggleText={supportRequest.label}
type={FormFieldTypes.CHECKBOX}
key={supportRequest.key}
id={supportRequest.key}
onChange={handleSupportRequestsChange} />;
})}
{supportRequests.checkRequestDataAccess && (
<div
Expand All @@ -152,15 +150,13 @@ export default function RequestRole(props) {
<div style={{ margin: '15px 0 10px' }}>
Is there anything else you would like to request?
</div>
<h>
<FormField
type={FormFieldTypes.TEXTAREA}
id='extraRequest'
placeholder='Enter your request'
maxLength='512'
rows='3'
onChange={handleSupportRequestsChange} />
</h>
<FormField
type={FormFieldTypes.TEXTAREA}
id='extraRequest'
placeholder='Enter your request'
maxLength='512'
rows='3'
onChange={handleSupportRequestsChange} />
</div>
<button
id='btn_save'
Expand Down
30 changes: 13 additions & 17 deletions src/pages/user_profile/UserProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default function UserProfile(props) {
id='researcherProfile'
color='common'
title='Your Profile'
descriptionStyle={{fontSize: '10000px'}}
descriptionStyle={{ fontSize: '10000px' }}
style={{
float: 'left',
}}
Expand Down Expand Up @@ -124,23 +124,19 @@ export default function UserProfile(props) {
>
Full Name
</h1>
<h>
<FormField
type={FormFieldTypes.TEXT}
id='profileName'
defaultValue={profile.profileName}
disabled={true}
/>
</h>
<FormField
type={FormFieldTypes.TEXT}
id='profileName'
defaultValue={profile.profileName}
disabled={true}
/>
<div style={{ marginTop: '10px' }} />
<h>
<FormField
type={FormFieldTypes.TEXT}
id='profileEmail'
defaultValue={profile.email}
disabled={true}
/>
</h>
<FormField
type={FormFieldTypes.TEXT}
id='profileEmail'
defaultValue={profile.email}
disabled={true}
/>
<div style={{ marginTop: '60px' }} />
<div style={{ 'marginTop': '60px' }} />
<ControlledAccessGrants />
Expand Down

0 comments on commit 6ae56a4

Please sign in to comment.