Skip to content

Commit

Permalink
[DUOS-2974] Refactor the AdminEditUser Component (#2516)
Browse files Browse the repository at this point in the history
  • Loading branch information
PintoGideon authored Apr 10, 2024
1 parent fc75667 commit ecbf754
Show file tree
Hide file tree
Showing 4 changed files with 404 additions and 427 deletions.
81 changes: 0 additions & 81 deletions src/components/ResearcherReview.js

This file was deleted.

68 changes: 68 additions & 0 deletions src/components/ResearcherReview.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import React, {useState, useEffect} from 'react';
import {getPropertyValuesFromUser} from '../libs/utils';
import {isNil} from 'lodash/fp';
import { isEmpty } from 'lodash';

export const ResearcherReview = (props) => {
const [state, setState] = useState({
value: '',
user: {},
institution: {},
researcherProperties: {
eraCommonsId: ''
}
});

useEffect(() => {
const user = props.user;
let researcherProps = getPropertyValuesFromUser(user);
setState((prev) => ({
...prev,
user: user,
institution: !isEmpty(user.institution) ? user.institution : null,
researcherProperties: researcherProps
}));
}, [props.user]);

const { researcherProperties, user, institution } = state;

return (
<div className="container">
<div className="col-lg-10 col-lg-offset-1 col-md-10 col-md-offset-1 col-sm-12 col-xs-12 no-padding">
<form name="researcherForm" noValidate={true}>
<div className="row form-group margin-top-20">
<div className="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<label className="control-label">Full Name</label>
<div id="lbl_profileName" className="control-data" name="profileName" readOnly={true}>
{user.displayName}
</div>
</div>
</div>

<div className="row margin-top-20">
<div className="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<label className="control-label rp-title-question default-color">Researcher Identification</label>
</div>
</div>

<div className="row no-margin">
<div className="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<label className="control-label">NIH User Name</label>
<div id="lbl_profileeraCommonsId" className="control-data" name="profileeraCommonsId" readOnly={true}>
{researcherProperties.eraCommonsId}
</div>
</div>
<div className="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<label className="control-label">Institution Name</label>
<div id="lbl_profileInstitution" className="control-data" name="profileInstitution" readOnly={true}>
{isNil(institution) ? '' : institution.name}
</div>
</div>
</div>
</form>
</div>
</div>
);
};

export default ResearcherReview;
Loading

0 comments on commit ecbf754

Please sign in to comment.