Skip to content

Commit

Permalink
fix: only title for nb showing
Browse files Browse the repository at this point in the history
  • Loading branch information
hegeaal committed Jan 16, 2025
1 parent 2af1c08 commit b7832fe
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 25 deletions.
50 changes: 27 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/context/table-context/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Props as RowProps } from '../../components/table/table-row';
import { CellType } from '../../components/table/table-header';

import { RegistrationStatus } from '../../utils/types/enums';
import { getTranslateText } from '../../utils/language/translateText';

type SORT_ORDER = 'ascending' | 'descending' | 'unsorted';
type FILTER_TYPE = { type: 'status'; value: RegistrationStatus } | { type: 'search' | 'status'; value: string };
Expand Down Expand Up @@ -53,7 +54,7 @@ const getFilteredDatasets = (state: STATE): Dataset[] => {
switch (state.filter?.type) {
case 'search':
return state.datasets.filter(dataset => !state.filter?.value ||
dataset.title?.nb?.toLowerCase().includes(state.filter?.value.toString().toLocaleLowerCase())
getTranslateText(dataset?.title).toLowerCase().includes(state.filter?.value.toString().toLocaleLowerCase())
);
case 'status':
return state.datasets.filter(dataset => !state.filter?.value ||
Expand Down
3 changes: 2 additions & 1 deletion src/pages/datasets-page/populated-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Props as RowProps } from '../../components/table/table-row';
import { SORT_BY_TYPE, SORT_TYPE } from '../../context/table-context/reducer';
import env from '../../utils/constants/env';
import { useDatasetsContext } from '../../context/datasets-context';
import { getTranslateText } from '../../utils/language/translateText';

const { FDK_REGISTRATION_BASE_URI } = env;

Expand Down Expand Up @@ -99,7 +100,7 @@ const getRows = (datasets: Dataset[], catalogId: string): RowProps<ColumnProps>[
icon: <Icon name={dataset.specializedType === 'SERIES' ? 'squareThreeStroke' : 'squareTextStroke'} />,
width: colWidths.col_4,
},
{ text: dataset.title?.nb ?? 'Mangler tittel', width: colWidths.col_1 },
{ text: dataset?.title ? getTranslateText(dataset.title) : 'Mangler tittel', width: colWidths.col_1 },
{ text: dataset?._lastModified && getDate(dataset?._lastModified), width: colWidths.col_2 },
{ tag: getTag(dataset?.registrationStatus), width: colWidths.col_3 },
],
Expand Down

0 comments on commit b7832fe

Please sign in to comment.