From 5f8ddc85292c94b80d0728e563716a8e913b8ca8 Mon Sep 17 00:00:00 2001 From: Sny Date: Fri, 13 Dec 2024 10:31:50 +0530 Subject: [PATCH] OpenConceptLab/ocl_issues#1972 | added collapse option --- src/components/common/TagCountLabel.jsx | 2 +- src/components/concepts/Associations.jsx | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/components/common/TagCountLabel.jsx b/src/components/common/TagCountLabel.jsx index bd0a55a4..b6b09f9b 100644 --- a/src/components/common/TagCountLabel.jsx +++ b/src/components/common/TagCountLabel.jsx @@ -8,7 +8,7 @@ const TabCountLabel = ({label, count}) => { return ( - {label} + {label} {count.toLocaleString()} diff --git a/src/components/concepts/Associations.jsx b/src/components/concepts/Associations.jsx index cd7db61b..49f844ad 100644 --- a/src/components/concepts/Associations.jsx +++ b/src/components/concepts/Associations.jsx @@ -13,8 +13,11 @@ import Button from '@mui/material/Button' import Chip from '@mui/material/Chip' import Skeleton from '@mui/material/Skeleton' import ButtonGroup from '@mui/material/ButtonGroup' + import SelectedIcon from '@mui/icons-material/Done'; -import { get, isEmpty, forEach, map, find, compact, flatten, values, filter } from 'lodash'; +import UpIcon from '@mui/icons-material/KeyboardArrowUp'; +import DownIcon from '@mui/icons-material/KeyboardArrowDown'; +import { get, isEmpty, forEach, map, find, compact, flatten, values, filter, without } from 'lodash'; import ConceptIcon from './ConceptIcon' import { generateRandomString, dropVersion, URIToParentParams, toParentURI } from '../../common/utils' import TagCountLabel from '../common/TagCountLabel' @@ -84,11 +87,11 @@ const MappingCells = ({mapping, isIndirect}) => { } -const AssociationRow = ({mappings, id, mapType, isSelf, isIndirect}) => { +const AssociationRow = ({mappings, id, mapType, isSelf, isIndirect, hide}) => { const { t } = useTranslation() return ( - + @@ -116,7 +119,7 @@ const AssociationRow = ({mappings, id, mapType, isSelf, isIndirect}) => { { map(mappings?.slice(1), (mapping, index) => { return (!mapping || isEmpty(mapping)) ? null : ( - + ) @@ -133,6 +136,7 @@ const Associations = ({concept, mappings, reverseMappings, ownerMappings, revers const [orderedMappings, setOrderedMappings] = React.useState({}); const [orderedOwnerMappings, setOrderedOwnerMappings] = React.useState({}); const [ownerMappingsGroupedByRepo, setOwnerMappingsGroupedByRepo] = React.useState({}); + const [collapsedSections, setCollapsedSections] = React.useState([]) const { t } = useTranslation() const getMappings = () => { let _mappings = {} @@ -183,11 +187,12 @@ const Associations = ({concept, mappings, reverseMappings, ownerMappings, revers loadingOwnerMappings === null ? onLoadOwnerMappings() : undefined } } + const toggleSection = repoURI => setCollapsedSections(collapsedSections?.includes(repoURI) ? without(collapsedSections, repoURI) : [...collapsedSections, repoURI]) return ( - +