Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwiniHerle committed Oct 8, 2024
1 parent 03c3136 commit d6bdd2c
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ export default class ReactionDetailsContainers extends Component {
});
}

handleChange(container) {
handleChange = () => {
const { handleReactionChange } = this.props;
const { reaction } = this.state;
handleReactionChange(reaction);
}
};

handleSpChange(reaction, cb) {
const { handleReactionChange } = this.props;
Expand Down Expand Up @@ -352,57 +352,57 @@ export default class ReactionDetailsContainers extends Component {

if (analyses_container.length === 1 && analyses_container[0].children.length > 0) {
return (
<div>
<div className="d-flex justify-content-end align-items-center mb-3">
{this.addButton()}
</div>
<Accordion
className='border rounded overflow-hidden'
onSelect={this.handleAccordionOpen}
activeKey={activeContainer}
>
{analyses_container[0].children.map((container, key) => {
const isFirstTab = key === 0;
return (
<Card
ref={(element) => { this.containerRefs[key] = element; }}
key={`reaction_container_${container.id}`}
className={"rounded-0 border-0" + (isFirstTab ? '' : ' border-top')}
>
<Card.Header className="rounded-0 p-0 border-bottom-0">
<AccordionHeaderWithButtons eventKey={key}>
{container.is_deleted ? containerHeaderDeleted(container) : containerHeader(container)}
</AccordionHeaderWithButtons>
</Card.Header>

{!container.is_deleted &&
<Accordion.Collapse eventKey={key}>
<Card.Body>
<ContainerComponent
disabled={readOnly}
readOnly={readOnly}
templateType="reaction"
container={container}
onChange={this.handleChange.bind(this, container)}
/>
<ViewSpectra
sample={reaction}
handleSampleChanged={this.handleSpChange}
handleSubmit={this.props.handleSubmit}
/>
<NMRiumDisplayer
sample={reaction}
handleSampleChanged={this.handleSpChange}
handleSubmit={this.props.handleSubmit}
/>
</Card.Body>
</Accordion.Collapse>
}
</Card>
);
})}
</Accordion>
<div>
<div className="d-flex justify-content-end align-items-center mb-3">
{this.addButton()}
</div>
<Accordion
className='border rounded overflow-hidden'
onSelect={this.handleAccordionOpen}
activeKey={activeContainer}
>
{analyses_container[0].children.map((container, key) => {
const isFirstTab = key === 0;
return (
<Card
ref={(element) => { this.containerRefs[key] = element; }}
key={`reaction_container_${container.id}`}
className={`rounded-0 border-0${isFirstTab ? '' : ' border-top'}`}
>
<Card.Header className="rounded-0 p-0 border-bottom-0">
<AccordionHeaderWithButtons eventKey={key}>
{container.is_deleted ? containerHeaderDeleted(container) : containerHeader(container)}
</AccordionHeaderWithButtons>
</Card.Header>

{!container.is_deleted && (
<Accordion.Collapse eventKey={key}>
<Card.Body>
<ContainerComponent
disabled={readOnly}
readOnly={readOnly}
templateType="reaction"
container={container}
onChange={() => this.handleChange(container)}
/>
<ViewSpectra
sample={reaction}
handleSampleChanged={this.handleSpChange}
handleSubmit={this.props.handleSubmit}
/>
<NMRiumDisplayer
sample={reaction}
handleSampleChanged={this.handleSpChange}
handleSubmit={this.props.handleSubmit}
/>
</Card.Body>
</Accordion.Collapse>
)}
</Card>
);
})}
</Accordion>
</div>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,13 @@ export default class ResearchPlanDetailsContainers extends Component {

return (
<div className="d-flex w-100 mb-0 align-items-center">
<span className="flex-grow-1 text-decoration-line-through">
<strike className="flex-grow-1">
{container.name}
{titleKind}
{titleStatus}
</span>
</strike>
<Button
className="ml-auto"
className="ms-auto"
size="xsm"
variant="danger"
onClick={() => this.handleUndo(container)}
Expand All @@ -270,47 +270,48 @@ export default class ResearchPlanDetailsContainers extends Component {
{this.addButton()}
</div>
<Accordion
className='border rounded overflow-hidden'
className="border rounded overflow-hidden"
onSelect={this.handleAccordionOpen}
activeKey={activeContainer}
>
{analysesContainer[0].children.map((container, key) => {
const isFirstTab = key === 0;
return (
<Card
eventKey={key}
key={`research_plan_container_${container.id}`}
className="border-0 rounded-0"
className={`rounded-0 border-0 ${isFirstTab ? '' : ' border-top'}`}
>
<Card.Header className="rounded-0 p-0 border-bottom-0">
<AccordionHeaderWithButtons eventKey={key}>
{container.is_deleted ? containerHeaderDeleted(container) : containerHeader(container)}
</AccordionHeaderWithButtons>
</Card.Header>

{!container.is_deleted &&
<Accordion.Collapse eventKey={key}>
<Card.Body>
<ContainerComponent
templateType="researchPlan"
readOnly={readOnly}
disabled={readOnly}
container={container}
onChange={this.handleChange}
/>
<ViewSpectra
sample={this.props.researchPlan}
handleSampleChanged={this.handleSpChange}
handleSubmit={this.props.handleSubmit}
/>
<NMRiumDisplayer
sample={this.props.researchPlan}
handleSampleChanged={this.handleSpChange}
handleSubmit={this.props.handleSubmit}
/>
</Card.Body>
{!container.is_deleted && (
<Accordion.Collapse eventKey={key}>
<Card.Body>
<ContainerComponent
templateType="researchPlan"
readOnly={readOnly}
disabled={readOnly}
container={container}
onChange={this.handleChange}
/>
<ViewSpectra
sample={this.props.researchPlan}
handleSampleChanged={this.handleSpChange}
handleSubmit={this.props.handleSubmit}
/>
<NMRiumDisplayer
sample={this.props.researchPlan}
handleSampleChanged={this.handleSpChange}
handleSubmit={this.props.handleSubmit}
/>
</Card.Body>
</Accordion.Collapse>
}
</Card>
)}
</Card>
);
})}
</Accordion>
Expand Down

0 comments on commit d6bdd2c

Please sign in to comment.