From af5573199c6f67d34ee548a73b79292a8f00b0df Mon Sep 17 00:00:00 2001 From: Birk Johansson Date: Tue, 30 Jan 2024 01:51:07 +0100 Subject: [PATCH] refactor: minor cleanup --- .../sectionList/listView/ManageListView.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/sectionList/listView/ManageListView.tsx b/src/components/sectionList/listView/ManageListView.tsx index e17695a4..ca13fd36 100644 --- a/src/components/sectionList/listView/ManageListView.tsx +++ b/src/components/sectionList/listView/ManageListView.tsx @@ -22,6 +22,8 @@ type ManageColumnsDialogProps = { } const toPath = (propertyDescriptor: { path: string }) => propertyDescriptor.path +const toFilterKey = (filterDescriptor: { filterKey: string }) => + filterDescriptor.filterKey type FormValues = { columns: string[] @@ -83,8 +85,8 @@ export const ManageListView = ({ : columnsConfig.default.map(toPath), filters: savedFilters.length > 0 - ? savedFilters.map((f) => f.filterKey) - : filtersConfig.default.map((f) => f.filterKey), + ? savedFilters.map(toFilterKey) + : filtersConfig.default.map(toFilterKey), } }, [savedFilters, savedColumns, filtersConfig, columnsConfig]) @@ -102,9 +104,7 @@ export const ManageListView = ({ availableLabel={i18n.t('Available columns')} selectedLabel={i18n.t('Selected columns')} loading={query.isLoading} - defaultOptions={columnsConfig.default.map( - (c) => c.path - )} + defaultOptions={columnsConfig.default.map(toPath)} availableOptions={columnsConfig.available.map( (c) => ({ label: c.label, value: c.path }) )} @@ -115,10 +115,10 @@ export const ManageListView = ({ selectedLabel={i18n.t('Selected filters')} loading={query.isLoading} defaultOptions={filtersConfig.default.map( - (c) => c.filterKey + toFilterKey )} availableOptions={filtersConfig.available.map( - (c) => ({ label: c.label, value: c.filterKey }) + (f) => ({ label: f.label, value: f.filterKey }) )} /> {submitError && (