Skip to content
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

fix(quickfilter): SKFP-1362 map icon to facet #4175

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading