diff --git a/src/components/SelectionList/ListItem/types.ts b/src/components/SelectionList/ListItem/types.ts index b11dfc1c6028..c91c0d9d3403 100644 --- a/src/components/SelectionList/ListItem/types.ts +++ b/src/components/SelectionList/ListItem/types.ts @@ -111,7 +111,7 @@ type ListItem = { itemStyle?: StyleProp; /** Boolean whether to display the right icon */ - shouldShowRightIcon?: boolean; + shouldShowRightCaret?: boolean; /** Whether product training tooltips can be displayed */ canShowProductTrainingTooltip?: boolean; @@ -249,6 +249,8 @@ type BaseListItemProps = CommonListItemProps & { testID?: string; /** Whether to show the default right hand side checkmark */ shouldUseDefaultRightHandSideCheckmark?: boolean; + /** Whether to show the right caret icon */ + shouldShowRightCaret?: boolean; }; type RadioListItemProps = ListItemProps; diff --git a/src/components/SelectionListWithModal/CustomListHeader.tsx b/src/components/SelectionListWithModal/CustomListHeader.tsx index af67a4a5d09e..26e523a21f71 100644 --- a/src/components/SelectionListWithModal/CustomListHeader.tsx +++ b/src/components/SelectionListWithModal/CustomListHeader.tsx @@ -9,9 +9,10 @@ type CustomListHeaderProps = { leftHeaderText?: string | undefined; rightHeaderText?: string | undefined; rightHeaderMinimumWidth?: number; + shouldShowRightCaret?: boolean; }; -function CustomListHeader({canSelectMultiple, leftHeaderText = '', rightHeaderText = '', rightHeaderMinimumWidth = 60}: CustomListHeaderProps) { +function CustomListHeader({canSelectMultiple, leftHeaderText = '', rightHeaderText = '', rightHeaderMinimumWidth = 60, shouldShowRightCaret = false}: CustomListHeaderProps) { const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); @@ -26,7 +27,7 @@ function CustomListHeader({canSelectMultiple, leftHeaderText = '', rightHeaderTe ]} > {leftHeaderText} - + {rightHeaderText} diff --git a/src/components/SelectionListWithSections/BaseListItem.tsx b/src/components/SelectionListWithSections/BaseListItem.tsx index 8a3bfc193e76..3c106b93e7fe 100644 --- a/src/components/SelectionListWithSections/BaseListItem.tsx +++ b/src/components/SelectionListWithSections/BaseListItem.tsx @@ -42,6 +42,7 @@ function BaseListItem({ testID, shouldUseDefaultRightHandSideCheckmark = true, forwardedFSClass, + shouldShowRightCaret = false, }: BaseListItemProps) { const theme = useTheme(); const styles = useThemeStyles(); @@ -152,6 +153,17 @@ function BaseListItem({ )} {rightHandSideComponentRender()} + {shouldShowRightCaret && ( + + + + )} {FooterComponent} diff --git a/src/components/SelectionListWithSections/BaseSelectionListItemRenderer.tsx b/src/components/SelectionListWithSections/BaseSelectionListItemRenderer.tsx index 67abc55b16d7..5842a17b4db5 100644 --- a/src/components/SelectionListWithSections/BaseSelectionListItemRenderer.tsx +++ b/src/components/SelectionListWithSections/BaseSelectionListItemRenderer.tsx @@ -55,6 +55,7 @@ function BaseSelectionListItemRenderer({ isUserValidated, personalDetails, userBillingFundID, + shouldShowRightCaret, }: BaseSelectionListItemRendererProps) { const handleOnCheckboxPress = () => { if (isTransactionGroupListItemType(item)) { @@ -111,6 +112,7 @@ function BaseSelectionListItemRenderer({ personalDetails={personalDetails} userBillingFundID={userBillingFundID} index={index} + shouldShowRightCaret={shouldShowRightCaret} /> {item.footerContent && item.footerContent} diff --git a/src/components/SelectionListWithSections/BaseSelectionListWithSections.tsx b/src/components/SelectionListWithSections/BaseSelectionListWithSections.tsx index 68de014f5a9a..5251d81ea0c7 100644 --- a/src/components/SelectionListWithSections/BaseSelectionListWithSections.tsx +++ b/src/components/SelectionListWithSections/BaseSelectionListWithSections.tsx @@ -149,6 +149,7 @@ function BaseSelectionListWithSections({ isSelected, canShowProductTrainingTooltip, renderScrollComponent, + shouldShowRightCaret, ref, }: SelectionListProps) { const styles = useThemeStyles(); @@ -680,6 +681,7 @@ function BaseSelectionListWithSections({ singleExecution={singleExecution} titleContainerStyles={listItemTitleContainerStyles} canShowProductTrainingTooltip={canShowProductTrainingTooltipMemo} + shouldShowRightCaret={shouldShowRightCaret} /> ); diff --git a/src/components/SelectionListWithSections/TableListItem.tsx b/src/components/SelectionListWithSections/TableListItem.tsx index 3f1d6f46913b..4e44d749d3c4 100644 --- a/src/components/SelectionListWithSections/TableListItem.tsx +++ b/src/components/SelectionListWithSections/TableListItem.tsx @@ -28,6 +28,7 @@ function TableListItem({ shouldSyncFocus, titleContainerStyles, shouldUseDefaultRightHandSideCheckmark, + shouldShowRightCaret, }: TableListItemProps) { const styles = useThemeStyles(); const theme = useTheme(); @@ -82,6 +83,7 @@ function TableListItem({ shouldSyncFocus={shouldSyncFocus} hoverStyle={item.isSelected && styles.activeComponentBG} shouldUseDefaultRightHandSideCheckmark={shouldUseDefaultRightHandSideCheckmark} + shouldShowRightCaret={shouldShowRightCaret} > {(hovered) => ( <> diff --git a/src/components/SelectionListWithSections/types.ts b/src/components/SelectionListWithSections/types.ts index 8413f2f2df03..a317aedb1231 100644 --- a/src/components/SelectionListWithSections/types.ts +++ b/src/components/SelectionListWithSections/types.ts @@ -108,6 +108,9 @@ type CommonListItemProps = { /** Callback to fire when the item is long pressed */ onLongPressRow?: (item: TItem) => void; + + /** Whether to show the right caret */ + shouldShowRightCaret?: boolean; } & TRightHandSideComponent; type ListItemFocusEventHandler = (event: NativeSyntheticEvent) => void; @@ -910,6 +913,9 @@ type SelectionListProps = Partial & { /** Custom scroll component to use instead of the default ScrollView */ renderScrollComponent?: (props: ScrollViewProps) => ReactElement>; + + /** Whether to show the right caret icon */ + shouldShowRightCaret?: boolean; } & TRightHandSideComponent; type SelectionListHandle = { diff --git a/src/pages/workspace/WorkspaceMembersPage.tsx b/src/pages/workspace/WorkspaceMembersPage.tsx index b193126bcbf8..b0577388e9ac 100644 --- a/src/pages/workspace/WorkspaceMembersPage.tsx +++ b/src/pages/workspace/WorkspaceMembersPage.tsx @@ -549,6 +549,7 @@ function WorkspaceMembersPage({personalDetails, route, policy}: WorkspaceMembers canSelectMultiple={canSelectMultiple} leftHeaderText={translate('common.member')} rightHeaderText={translate('common.role')} + shouldShowRightCaret /> ); }; @@ -821,6 +822,7 @@ function WorkspaceMembersPage({personalDetails, route, policy}: WorkspaceMembers listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} showScrollIndicator={false} addBottomSafeAreaPadding + shouldShowRightCaret /> )} diff --git a/src/pages/workspace/WorkspacesListPage.tsx b/src/pages/workspace/WorkspacesListPage.tsx index ee2c12844922..8b9ec811b53c 100755 --- a/src/pages/workspace/WorkspacesListPage.tsx +++ b/src/pages/workspace/WorkspacesListPage.tsx @@ -315,6 +315,7 @@ function WorkspacesListPage() { isDefault={isDefault} isLoadingBill={isLoadingBill} resetLoadingSpinnerIconIndex={resetLoadingSpinnerIconIndex} + isHovered={hovered} /> )} @@ -474,7 +475,7 @@ function WorkspacesListPage() { {translate('workspace.common.workspaceType')} - + )} diff --git a/src/pages/workspace/WorkspacesListRow.tsx b/src/pages/workspace/WorkspacesListRow.tsx index 51acd76564fc..a6b9aa4efa52 100644 --- a/src/pages/workspace/WorkspacesListRow.tsx +++ b/src/pages/workspace/WorkspacesListRow.tsx @@ -81,6 +81,9 @@ type WorkspacesListRowProps = WithCurrentUserPersonalDetailsProps & { /** Function to reset loading spinner icon index */ resetLoadingSpinnerIconIndex?: () => void; + + /** Whether the list item is hovered */ + isHovered?: boolean; }; type BrickRoadIndicatorIconProps = { @@ -128,6 +131,7 @@ function WorkspacesListRow({ isDefault, isLoadingBill, resetLoadingSpinnerIconIndex, + isHovered, }: WorkspacesListRowProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); @@ -287,6 +291,17 @@ function WorkspacesListRow({ {!isNarrow && ThreeDotMenuOrPendingIcon} + {!isNarrow && ( + + + + )} ); diff --git a/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx b/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx index 609b023062aa..589e21d7ea5e 100644 --- a/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx +++ b/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx @@ -242,6 +242,7 @@ function WorkspaceCategoriesPage({route}: WorkspaceCategoriesPageProps) { canSelectMultiple={canSelectMultiple} leftHeaderText={translate('common.name')} rightHeaderText={translate('common.enabled')} + shouldShowRightCaret /> ); }; @@ -592,6 +593,7 @@ function WorkspaceCategoriesPage({route}: WorkspaceCategoriesPageProps) { listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} showScrollIndicator={false} addBottomSafeAreaPadding + shouldShowRightCaret /> )} {!hasVisibleCategories && !isLoading && inputValue.length === 0 && ( diff --git a/src/pages/workspace/companyCards/WorkspaceCompanyCardsList.tsx b/src/pages/workspace/companyCards/WorkspaceCompanyCardsList.tsx index 9eb06d033514..8062cedc341b 100644 --- a/src/pages/workspace/companyCards/WorkspaceCompanyCardsList.tsx +++ b/src/pages/workspace/companyCards/WorkspaceCompanyCardsList.tsx @@ -113,7 +113,7 @@ function WorkspaceCompanyCardsList({cardsList, policyID, handleAssignCard, isDis {translate('workspace.expensifyCard.lastFour')} diff --git a/src/pages/workspace/companyCards/WorkspaceCompanyCardsListRow.tsx b/src/pages/workspace/companyCards/WorkspaceCompanyCardsListRow.tsx index 5c85d2e40ae0..7eae8c2240f7 100644 --- a/src/pages/workspace/companyCards/WorkspaceCompanyCardsListRow.tsx +++ b/src/pages/workspace/companyCards/WorkspaceCompanyCardsListRow.tsx @@ -1,9 +1,12 @@ import React, {useMemo} from 'react'; import {View} from 'react-native'; import Avatar from '@components/Avatar'; +import Icon from '@components/Icon'; +import * as Expensicons from '@components/Icon/Expensicons'; import Text from '@components/Text'; +import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; +import {getDisplayNameOrDefault} from '@libs/PersonalDetailsUtils'; import {getDefaultAvatarURL} from '@libs/UserUtils'; import CONST from '@src/CONST'; import type {PersonalDetails} from '@src/types/onyx'; @@ -21,8 +24,8 @@ type WorkspaceCompanyCardsListRowProps = { function WorkspaceCompanyCardsListRow({cardholder, name, cardNumber}: WorkspaceCompanyCardsListRowProps) { const styles = useThemeStyles(); - const cardholderName = useMemo(() => PersonalDetailsUtils.getDisplayNameOrDefault(cardholder), [cardholder]); - + const cardholderName = useMemo(() => getDisplayNameOrDefault(cardholder), [cardholder]); + const theme = useTheme(); return ( @@ -55,6 +58,15 @@ function WorkspaceCompanyCardsListRow({cardholder, name, cardNumber}: WorkspaceC {cardNumber} + + + ); } diff --git a/src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx b/src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx index a0b7cb33a810..01f22c697327 100644 --- a/src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx +++ b/src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx @@ -345,6 +345,7 @@ function PolicyDistanceRatesPage({ canSelectMultiple={canSelectMultiple} leftHeaderText={translate('workspace.distanceRates.rate')} rightHeaderText={translate('common.enabled')} + shouldShowRightCaret /> ); }; @@ -509,6 +510,7 @@ function PolicyDistanceRatesPage({ shouldShowListEmptyContent={false} listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} showScrollIndicator={false} + shouldShowRightCaret /> )} - + getDisplayNameOrDefault(cardholder), [cardholder]); const cardType = isVirtual ? translate('workspace.expensifyCard.virtual') : translate('workspace.expensifyCard.physical'); return ( )} + + + ); } diff --git a/src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx b/src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx index ed23f5165b9b..b5d889c3018c 100644 --- a/src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx +++ b/src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx @@ -226,7 +226,7 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) { return null; } const header = ( - + {translate('common.destination')} @@ -458,6 +458,7 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) { listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} listItemTitleContainerStyles={styles.flex3} showScrollIndicator={false} + shouldShowRightCaret /> )} {!hasVisibleSubRates && !isLoading && ( diff --git a/src/pages/workspace/reports/ReportFieldsListValuesPage.tsx b/src/pages/workspace/reports/ReportFieldsListValuesPage.tsx index ae5d88e7aaf2..654cbb381d56 100644 --- a/src/pages/workspace/reports/ReportFieldsListValuesPage.tsx +++ b/src/pages/workspace/reports/ReportFieldsListValuesPage.tsx @@ -213,6 +213,7 @@ function ReportFieldsListValuesPage({ canSelectMultiple={canSelectMultiple} leftHeaderText={translate('common.name')} rightHeaderText={translate('common.enabled')} + shouldShowRightCaret /> ); }; @@ -402,6 +403,7 @@ function ReportFieldsListValuesPage({ shouldPreventDefaultFocusOnSelectRow={!canUseTouchScreen()} listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} showScrollIndicator={false} + shouldShowRightCaret /> )} [getTagLists(policyTags), isMultiLevelTagsPolicyUtils(policyTags), hasDependentTagsPolicyUtils(policy, policyTags), hasIndependentTagsPolicyUtils(policy, policyTags)], [policy, policyTags], ); + const canSelectMultiple = !hasDependentTags && (shouldUseNarrowLayout ? isMobileSelectionModeEnabled : true); const fetchTags = useCallback(() => { openPolicyTagsPage(policyID); @@ -235,10 +236,7 @@ function WorkspaceTagsPage({route}: WorkspaceTagsPageProps) { required: policyTagList.required, isDisabledCheckbox: isSwitchDisabled, rightElement: hasDependentTags ? ( - + ) : ( ); } @@ -344,6 +342,7 @@ function WorkspaceTagsPage({route}: WorkspaceTagsPageProps) { canSelectMultiple={canSelectMultiple} leftHeaderText={translate('common.name')} rightHeaderText={translate(isMultiLevelTags ? 'common.required' : 'common.enabled')} + shouldShowRightCaret /> ); }; @@ -719,6 +718,7 @@ function WorkspaceTagsPage({route}: WorkspaceTagsPageProps) { onDismissError={(item) => !hasDependentTags && clearPolicyTagErrors({policyID, tagName: item.value, tagListIndex: 0, policyTags})} showScrollIndicator={false} addBottomSafeAreaPadding + shouldShowRightCaret /> )} {!hasVisibleTags && !isLoading && ( diff --git a/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx b/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx index cad3d7f11255..cb1c69f8573c 100644 --- a/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx +++ b/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx @@ -198,6 +198,7 @@ function WorkspaceViewTagsPage({route}: WorkspaceViewTagsProps) { canSelectMultiple={canSelectMultiple} leftHeaderText={translate('common.name')} rightHeaderText={hasDependentTags ? undefined : translate('common.enabled')} + shouldShowRightCaret /> ); }; @@ -426,6 +427,7 @@ function WorkspaceViewTagsPage({route}: WorkspaceViewTagsProps) { onDismissError={(item) => { clearPolicyTagErrors({policyID, tagName: item.value, tagListIndex: route.params.orderWeight, policyTags}); }} + shouldShowRightCaret /> )} ); }; @@ -437,6 +438,7 @@ function WorkspaceTaxesPage({ onDismissError={(item) => (item.keyForList ? clearTaxRateError(policyID, item.keyForList, item.pendingAction) : undefined)} showScrollIndicator={false} addBottomSafeAreaPadding + shouldShowRightCaret />