Skip to content

Commit

Permalink
#1389 applied tag.hidden logic, reduced autohide time for tags toasts…
Browse files Browse the repository at this point in the history
… to 5 seconds
  • Loading branch information
matej-vavrek committed Apr 18, 2024
1 parent 6395110 commit 75fc538
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions js/components/preview/tags/details/tagDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const TagDetails = memo(() => {
useEffect(() => {
const categoriesToRemove = getCategoriesToBeRemovedFromTagDetails(tagCategories);
const newTagList = preTagList.filter(t => {
if (t.additional_info?.downloadName || categoriesToRemove.some(c => c.id === t.category)) {
if (t.hidden === true || t.additional_info?.downloadName || categoriesToRemove.some(c => c.id === t.category)) {
return false;
} else {
return true;
Expand All @@ -201,8 +201,8 @@ const TagDetails = memo(() => {
const moleculesToEditIds = useSelector(state => state.selectionReducers.moleculesToEdit);
const moleculesToEdit =
moleculesToEditIds &&
moleculesToEditIds.length > 0 &&
!(moleculesToEditIds.length === 1 && moleculesToEditIds[0] === null)
moleculesToEditIds.length > 0 &&
!(moleculesToEditIds.length === 1 && moleculesToEditIds[0] === null)
? moleculesToEditIds.map(id => dispatch(getMoleculeForId(id)))
: [];

Expand Down
6 changes: 3 additions & 3 deletions js/components/preview/tags/modal/editTagsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export const EditTagsModal = ({ open, anchorEl, setOpenDialog }) => {
dispatch(appendTagList(augMolTagObject));
dispatch(appendMoleculeTag(molTag));
dispatch(setNoTagsReceived(false));
toastInfo('Tag was created');
toastInfo('Tag was created', { autoHideDuration: 5000 });
});
// reset tag/fields after creating new one
resetTagToEditState();
Expand Down Expand Up @@ -222,7 +222,7 @@ export const EditTagsModal = ({ open, anchorEl, setOpenDialog }) => {
)
);
}
toastInfo('Tag was updated');
toastInfo('Tag was updated', { autoHideDuration: 5000 });
// reset tag/fields after updating selected one
resetTagToEditState();
}
Expand All @@ -245,7 +245,7 @@ export const EditTagsModal = ({ open, anchorEl, setOpenDialog }) => {
});
}
deleteExistingTag(tag, tag.id);
toastInfo('Tag was deleted');
toastInfo('Tag was deleted', { autoHideDuration: 5000 });
// reset tag/fields after removing selected tag
resetTagToEditState();
}
Expand Down
2 changes: 1 addition & 1 deletion js/components/preview/tags/tagCategory.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const TagCategory = memo(({ tagClickCallback, disabled = false }) => {
let tagList = useSelector(state => state.apiReducers.tagList);
tagList = tagList
.filter(t => {
if (t.additional_info?.downloadName || listOfProhibitedCategories.some(cid => cid === t.category)) {
if (t.hidden || t.additional_info?.downloadName || listOfProhibitedCategories.some(cid => cid === t.category)) {
return false;
} else {
return true;
Expand Down
2 changes: 1 addition & 1 deletion js/components/preview/tags/utils/tagUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export const getAllTagsForLHSCmp = (observations, tagList, tagCategoryList) => {
obs?.tags_set.forEach(tagId => {
let tag = tagList.find(t => t.id === tagId);
if (
tag &&
tag && !tag.hidden &&
!restOfTheTags.some(t => t.id === tag.id) &&
!prioTags.some(t => t.id === tag.id) &&
!obsPrioTags.some(t => t.id === tag.id)
Expand Down

0 comments on commit 75fc538

Please sign in to comment.