-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add general comment field to analysis section of any element #2241
base: main
Are you sure you want to change the base?
feat: add general comment field to analysis section of any element #2241
Conversation
LCOV of commit
|
LCOV of commit
|
Chemotion.dev.2.webm |
@@ -0,0 +1,55 @@ | |||
import React from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1- Analysis component should not be in common componenets foler. I think calling it a Button would be more fitting.
2- Exporting 2 indiviual components from one file is not a standard for reusable components.
3- Building a wrapper or individual files would be a nice option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think common folder is suitable for reusable components. Both are closely related, therefore in one file. Building a wrapper that gather both components does not fit here, because both components are called in different positions.
import ElementStore from 'src/stores/alt/stores/ElementStore'; | ||
import OrderModeRow from 'src/apps/mydb/elements/details/cellLines/analysesTab/OrderModeRow'; | ||
import EditModeRow from 'src/apps/mydb/elements/details/cellLines/analysesTab/EditModeRow'; | ||
import PropTypes from 'prop-types'; | ||
import { CommentButton, CommentBox } from 'src/components/common/AnalysisCommentBoxComponent'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactoring requested
variant="primary" | ||
onClick={toggleCommentBox} | ||
> | ||
Add comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If its a toggle button it should convey user through UI.
|
||
handleCommentTextChange = (e) => { | ||
const { currentElement } = ElementStore.getState(); | ||
currentElement.container.description = e.target.value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Is description exists always?
- Checking for valid value before saving and triming the value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, description always exists.
@@ -234,8 +241,18 @@ export default class ReactionDetailsContainers extends Component { | |||
return null; | |||
} | |||
|
|||
handleCommentTextChange = (e) => { | |||
const { reaction } = this.props; | |||
reaction.container.description = e.target.value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking value is valid and trimmed before saving
function CommentBox({ isVisible, value, handleCommentTextChange }) { | ||
return isVisible && ( | ||
<Form.Group> | ||
<Form.Control |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: Have a placeholder for textarea would look nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Squashed commit of the following: commit acafbea Author: adambasha0 <adambasha1992@gmail.com> Date: Tue Nov 19 12:52:55 2024 +0000 refactor: add unit tests for AnalysisCommentBoxComponent commit 45e0515 Author: adambasha0 <adambasha1992@gmail.com> Date: Fri Nov 15 14:46:57 2024 +0000 refactor: comment box and comment button components for analysis tabs of reactions commit 12df07d Author: adambasha0 <adambasha1992@gmail.com> Date: Fri Nov 15 12:28:53 2024 +0000 feat: add comment box and comment button in analysis tabs for elements
Squashed commit of the following: commit acafbea Author: adambasha0 <adambasha1992@gmail.com> Date: Tue Nov 19 12:52:55 2024 +0000 refactor: add unit tests for AnalysisCommentBoxComponent commit 45e0515 Author: adambasha0 <adambasha1992@gmail.com> Date: Fri Nov 15 14:46:57 2024 +0000 refactor: comment box and comment button components for analysis tabs of reactions commit 12df07d Author: adambasha0 <adambasha1992@gmail.com> Date: Fri Nov 15 12:28:53 2024 +0000 feat: add comment box and comment button in analysis tabs for elements
Squashed commit of the following: commit acafbea Author: adambasha0 <adambasha1992@gmail.com> Date: Tue Nov 19 12:52:55 2024 +0000 refactor: add unit tests for AnalysisCommentBoxComponent commit 45e0515 Author: adambasha0 <adambasha1992@gmail.com> Date: Fri Nov 15 14:46:57 2024 +0000 refactor: comment box and comment button components for analysis tabs of reactions commit 12df07d Author: adambasha0 <adambasha1992@gmail.com> Date: Fri Nov 15 12:28:53 2024 +0000 feat: add comment box and comment button in analysis tabs for elements
Squashed commit of the following: commit acafbea Author: adambasha0 <adambasha1992@gmail.com> Date: Tue Nov 19 12:52:55 2024 +0000 refactor: add unit tests for AnalysisCommentBoxComponent commit 45e0515 Author: adambasha0 <adambasha1992@gmail.com> Date: Fri Nov 15 14:46:57 2024 +0000 refactor: comment box and comment button components for analysis tabs of reactions commit 12df07d Author: adambasha0 <adambasha1992@gmail.com> Date: Fri Nov 15 12:28:53 2024 +0000 feat: add comment box and comment button in analysis tabs for elements
allow user to add a general comment on the analyses section of any element (not related to commenting function on shared elements)