Skip to content

Commit

Permalink
fix(quickfilter): SKFP-1362 map icon to facet
Browse files Browse the repository at this point in the history
  • Loading branch information
lflangis committed Nov 28, 2024
1 parent 16b248e commit 7de2a71
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/views/DataExploration/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import BiospecimenUploadIds from './components/UploadIds/BiospecimenUploadIds';
import FileUploadIds from './components/UploadIds/FileUploadIds';
import ParticipantUploadIds from './components/UploadIds/ParticipantUploadIds';
import {
getFieldCategoryIcon,
getFieldWithoutPrefix,
getIndexFromQFValueFacet,
getSelectedOptionsByQuery,
Expand Down Expand Up @@ -405,7 +406,7 @@ const DataExploration = () => {
headerTooltip: false,
dictionary: getFacetsDictionary(),
noDataInputOption: false,
categoryIcon: <UserOutlined className={styles.categoryIcon} />,
categoryIcon: getFieldCategoryIcon(option.key, { className: styles.categoryIcon }),
});

const filters =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ExperimentOutlined, FileTextOutlined, UserOutlined } from '@ant-design/icons';
import { AntdIconProps } from '@ant-design/icons/lib/components/AntdIcon';
import { VisualType } from '@ferlab/ui/core/components/filters/types';
import { CheckboxQFOption } from '@ferlab/ui/core/components/SidebarMenu/QuickFilter';
import {
Expand All @@ -8,6 +10,17 @@ import {
import { INDEXES } from 'graphql/constants';
import { cloneDeep } from 'lodash';

export const getFieldCategoryIcon = (facetKey: string, props: AntdIconProps): React.ReactNode => {
if (facetKey.startsWith('files__biospecimens__')) {
return <ExperimentOutlined {...props} />;
}
if (facetKey.startsWith('files__')) {
return <FileTextOutlined {...props} />;
}

return <UserOutlined {...props} />;
};

export const getIndexFromQFValueFacet = (facetKey: string): INDEXES => {
if (facetKey.startsWith('files__biospecimens__')) return INDEXES.BIOSPECIMEN;
else if (facetKey.startsWith('files__')) return INDEXES.FILE;
Expand Down

0 comments on commit 7de2a71

Please sign in to comment.