diff --git a/src/CONST.ts b/src/CONST.ts index dc8fb1040a76..bdf181fe12da 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -941,20 +941,6 @@ const CONST = { RESIZE_DEBOUNCE_TIME: 100, UNREAD_UPDATE_DEBOUNCE_TIME: 300, }, - SEARCH_TABLE_COLUMNS: { - RECEIPT: 'receipt', - DATE: 'date', - MERCHANT: 'merchant', - DESCRIPTION: 'description', - FROM: 'from', - TO: 'to', - CATEGORY: 'category', - TAG: 'tag', - TOTAL_AMOUNT: 'amount', - TYPE: 'type', - ACTION: 'action', - TAX_AMOUNT: 'taxAmount', - }, PRIORITY_MODE: { GSD: 'gsd', DEFAULT: 'default', @@ -3540,12 +3526,7 @@ const CONST = { SCAN: 'scan', DISTANCE: 'distance', }, - TAB_SEARCH: { - ALL: 'all', - SHARED: 'shared', - DRAFTS: 'drafts', - FINISHED: 'finished', - }, + STATUS_TEXT_MAX_LENGTH: 100, DROPDOWN_BUTTON_SIZE: { @@ -4846,28 +4827,52 @@ const CONST = { ADHOC: ' AdHoc', }, - SEARCH_TRANSACTION_TYPE: { - CASH: 'cash', - CARD: 'card', - DISTANCE: 'distance', - }, - - SEARCH_RESULTS_PAGE_SIZE: 50, - - SEARCH_DATA_TYPES: { - TRANSACTION: 'transaction', - REPORT: 'report', + SEARCH: { + RESULTS_PAGE_SIZE: 50, + DATA_TYPES: { + TRANSACTION: 'transaction', + REPORT: 'report', + }, + ACTION_TYPES: { + DONE: 'done', + PAID: 'paid', + VIEW: 'view', + }, + TRANSACTION_TYPE: { + CASH: 'cash', + CARD: 'card', + DISTANCE: 'distance', + }, + SORT_ORDER: { + ASC: 'asc', + DESC: 'desc', + }, + TAB: { + ALL: 'all', + SHARED: 'shared', + DRAFTS: 'drafts', + FINISHED: 'finished', + }, + TABLE_COLUMNS: { + RECEIPT: 'receipt', + DATE: 'date', + MERCHANT: 'merchant', + DESCRIPTION: 'description', + FROM: 'from', + TO: 'to', + CATEGORY: 'category', + TAG: 'tag', + TOTAL_AMOUNT: 'amount', + TYPE: 'type', + ACTION: 'action', + TAX_AMOUNT: 'taxAmount', + }, }, REFERRER: { NOTIFICATION: 'notification', }, - SORT_ORDER: { - ASC: 'asc', - DESC: 'desc', - }, - SUBSCRIPTION_SIZE_LIMIT: 20000, PAYMENT_CARD_CURRENCY: { diff --git a/src/components/Search.tsx b/src/components/Search.tsx index 93792120fe99..cfb0192669d1 100644 --- a/src/components/Search.tsx +++ b/src/components/Search.tsx @@ -35,7 +35,7 @@ type SearchProps = { sortOrder?: SortOrder; }; -const sortableSearchTabs: SearchQuery[] = [CONST.TAB_SEARCH.ALL]; +const sortableSearchTabs: SearchQuery[] = [CONST.SEARCH.TAB.ALL]; const transactionItemMobileHeight = 100; const reportItemTransactionHeight = 52; const listItemPadding = 12; // this is equivalent to 'mb3' on every transaction/report list item @@ -125,7 +125,7 @@ function Search({query, policyIDs, sortBy, sortOrder}: SearchProps) { return; } const currentOffset = searchResults?.search?.offset ?? 0; - SearchActions.search({hash, query, offset: currentOffset + CONST.SEARCH_RESULTS_PAGE_SIZE, sortBy, sortOrder}); + SearchActions.search({hash, query, offset: currentOffset + CONST.SEARCH.RESULTS_PAGE_SIZE, sortBy, sortOrder}); }; const type = SearchUtils.getSearchType(searchResults?.search); diff --git a/src/components/SelectionList/Search/ActionCell.tsx b/src/components/SelectionList/Search/ActionCell.tsx new file mode 100644 index 000000000000..6aabfebf0da9 --- /dev/null +++ b/src/components/SelectionList/Search/ActionCell.tsx @@ -0,0 +1,62 @@ +import React from 'react'; +import {View} from 'react-native'; +import Badge from '@components/Badge'; +import Button from '@components/Button'; +import * as Expensicons from '@components/Icon/Expensicons'; +import useLocalize from '@hooks/useLocalize'; +import useStyleUtils from '@hooks/useStyleUtils'; +import useTheme from '@hooks/useTheme'; +import useThemeStyles from '@hooks/useThemeStyles'; +import variables from '@styles/variables'; +import CONST from '@src/CONST'; + +type ActionCellProps = { + onButtonPress: () => void; + action?: string; + isLargeScreenWidth?: boolean; +}; + +function ActionCell({onButtonPress, action = CONST.SEARCH.ACTION_TYPES.VIEW, isLargeScreenWidth = true}: ActionCellProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const theme = useTheme(); + const StyleUtils = useStyleUtils(); + + if (action === CONST.SEARCH.ACTION_TYPES.PAID || action === CONST.SEARCH.ACTION_TYPES.DONE) { + const buttonTextKey = action === CONST.SEARCH.ACTION_TYPES.PAID ? 'iou.settledExpensify' : 'common.done'; + return ( + + + + ); + } + + return ( +