From 7aeb49beb76b62553700bc37d5d3b5e23aee0ba5 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 17 Dec 2025 17:26:46 -0700 Subject: [PATCH 01/20] add draggable list --- src/pages/Search/SearchColumnsPage.tsx | 46 +++++++++++++++----------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/src/pages/Search/SearchColumnsPage.tsx b/src/pages/Search/SearchColumnsPage.tsx index 95774157ec52b..5317d3eeaef48 100644 --- a/src/pages/Search/SearchColumnsPage.tsx +++ b/src/pages/Search/SearchColumnsPage.tsx @@ -8,6 +8,7 @@ import type {SearchCustomColumnIds} from '@components/Search/types'; import type {ListItem} from '@components/SelectionList/types'; import SelectionList from '@components/SelectionListWithSections'; import MultiSelectListItem from '@components/SelectionListWithSections/MultiSelectListItem'; +import DraggableList from '@components/DraggableList'; import type {SectionListDataType} from '@components/SelectionListWithSections/types'; import TextLink from '@components/TextLink'; import useLocalize from '@hooks/useLocalize'; @@ -43,17 +44,12 @@ function SearchColumnsPage() { return columnIds; }); - const sections: Array> = [ - { - title: undefined, - data: allCustomColumns.map((columnId) => ({ - text: translate(getSearchColumnTranslationKey(columnId)), - value: columnId, - keyForList: columnId, - isSelected: selectedColumnIds?.includes(columnId), - })), - }, - ]; + const columnsList = selectedColumnIds.map((columnId) => ({ + text: translate(getSearchColumnTranslationKey(columnId)), + value: columnId, + keyForList: columnId, + isSelected: true, + })); const sortedDefaultColumns = [...defaultCustomColumns].sort(); const sortedSelectedColumnIds = [...selectedColumnIds].sort(); @@ -69,6 +65,10 @@ function SearchColumnsPage() { } }; + const onDragEnd = ({data}: {data: typeof columnsList}) => { + setSelectedColumnIds(data.map((item) => item.value)); + }; + const resetColumns = () => { setSelectedColumnIds(defaultCustomColumns); }; @@ -84,6 +84,16 @@ function SearchColumnsPage() { Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query: queryString}), {forceReplace: true}); }; + const renderItem = ({item}: {item: ListItem}) => { + return ( + + ); + }; + return ( {translate('search.resetColumns')}} - item.value} + onDragEnd={onDragEnd} + renderItem={renderItem} + ListFooterComponent={ {!selectedColumnIds.length && ( Date: Wed, 17 Dec 2025 17:31:33 -0700 Subject: [PATCH 02/20] update footer --- src/pages/Search/SearchColumnsPage.tsx | 55 ++++++++++++-------------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/src/pages/Search/SearchColumnsPage.tsx b/src/pages/Search/SearchColumnsPage.tsx index 5317d3eeaef48..e1fb66c639efa 100644 --- a/src/pages/Search/SearchColumnsPage.tsx +++ b/src/pages/Search/SearchColumnsPage.tsx @@ -6,10 +6,8 @@ import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; import type {SearchCustomColumnIds} from '@components/Search/types'; import type {ListItem} from '@components/SelectionList/types'; -import SelectionList from '@components/SelectionListWithSections'; import MultiSelectListItem from '@components/SelectionListWithSections/MultiSelectListItem'; import DraggableList from '@components/DraggableList'; -import type {SectionListDataType} from '@components/SelectionListWithSections/types'; import TextLink from '@components/TextLink'; import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; @@ -87,8 +85,8 @@ function SearchColumnsPage() { const renderItem = ({item}: {item: ListItem}) => { return ( ); @@ -104,33 +102,30 @@ function SearchColumnsPage() { {shouldShowResetColumns && {translate('search.resetColumns')}} - - item.value} - onDragEnd={onDragEnd} - renderItem={renderItem} - ListFooterComponent={ - - {!selectedColumnIds.length && ( - - )} - -