diff --git a/src/components/filter-box/filter-box.component.tsx b/src/components/filter-box/filter-box.component.tsx index 13efe3e1e..c33930c78 100644 --- a/src/components/filter-box/filter-box.component.tsx +++ b/src/components/filter-box/filter-box.component.tsx @@ -10,7 +10,7 @@ import localization from '../../lib/localization'; import { FilterOption } from '../filter-option/filter-option.component'; import './filter-box.scss'; -import { FilterSearchOption } from '../../types'; +import { SelectOption } from '../../types'; interface Props { htmlKey?: number; @@ -197,7 +197,7 @@ export class FilterBox extends React.Component { label: label || localization.facet.formatType.UNKNOWN }; }) - .sort((a: FilterSearchOption, b: FilterSearchOption) => + .sort((a: SelectOption, b: SelectOption) => a.label.localeCompare(b.label) ); diff --git a/src/pages/search-page/filter-tree/filter-tree.component.tsx b/src/pages/search-page/filter-tree/filter-tree.component.tsx index 45d7d7e01..9e870f6a8 100644 --- a/src/pages/search-page/filter-tree/filter-tree.component.tsx +++ b/src/pages/search-page/filter-tree/filter-tree.component.tsx @@ -12,7 +12,7 @@ import localization from '../../../lib/localization'; import { getTranslateText } from '../../../lib/translateText'; import './filter-tree.scss'; -import type { FilterSearchOption } from '../../../types'; +import type { SelectOption } from '../../../types'; import type { FilterChange } from '../../../components/filter-box/filter-box.component'; import TreeView from '../../../components/treeview'; @@ -271,13 +271,13 @@ export const FilterTree: FC = ({ label: `${getNameFromNode(node, referenceDataItems)}` }); - const mapNodeToFilterSearchOptions = (node: any): FilterSearchOption[] => + const mapNodeToFilterSearchOptions = (node: any): SelectOption[] => node.children ? [ getFilterSearchOption(node), ...(node.children.flatMap( mapNodeToFilterSearchOptions - ) as FilterSearchOption[]) + ) as SelectOption[]) ] : [getFilterSearchOption(node)]; diff --git a/src/types/domain.d.ts b/src/types/domain.d.ts index 9b87387c0..24f25c140 100644 --- a/src/types/domain.d.ts +++ b/src/types/domain.d.ts @@ -1117,7 +1117,7 @@ export interface CommentThread { timestamp: string; content: string; } -export interface FilterSearchOption { +export interface SelectOption { value: string; label: string; }