Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/SelectionList/ListItem/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ type ListItem<K extends string | number = string> = {
itemStyle?: StyleProp<ViewStyle>;

/** Boolean whether to display the right icon */
shouldShowRightIcon?: boolean;
shouldShowRightCaret?: boolean;

/** Whether product training tooltips can be displayed */
canShowProductTrainingTooltip?: boolean;
Expand Down Expand Up @@ -249,6 +249,8 @@ type BaseListItemProps<TItem extends ListItem> = CommonListItemProps<TItem> & {
testID?: string;
/** Whether to show the default right hand side checkmark */
shouldUseDefaultRightHandSideCheckmark?: boolean;
/** Whether to show the right caret icon */
shouldShowRightCaret?: boolean;
};
type RadioListItemProps<TItem extends ListItem> = ListItemProps<TItem>;

Expand Down
5 changes: 3 additions & 2 deletions src/components/SelectionListWithModal/CustomListHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -26,7 +27,7 @@ function CustomListHeader({canSelectMultiple, leftHeaderText = '', rightHeaderTe
]}
>
<Text style={styles.textMicroSupporting}>{leftHeaderText}</Text>
<View style={[StyleUtils.getMinimumWidth(rightHeaderMinimumWidth)]}>
<View style={[StyleUtils.getMinimumWidth(rightHeaderMinimumWidth), shouldShowRightCaret && styles.mr6]}>
<Text style={[styles.textMicroSupporting, styles.textAlignCenter]}>{rightHeaderText}</Text>
</View>
</View>
Expand Down
12 changes: 12 additions & 0 deletions src/components/SelectionListWithSections/BaseListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function BaseListItem<TItem extends ListItem>({
testID,
shouldUseDefaultRightHandSideCheckmark = true,
forwardedFSClass,
shouldShowRightCaret = false,
}: BaseListItemProps<TItem>) {
const theme = useTheme();
const styles = useThemeStyles();
Expand Down Expand Up @@ -152,6 +153,17 @@ function BaseListItem<TItem extends ListItem>({
)}

{rightHandSideComponentRender()}
{shouldShowRightCaret && (
<View style={[styles.justifyContentCenter, styles.alignItemsCenter, styles.ml2]}>
<Icon
src={Expensicons.ArrowRight}
fill={theme.icon}
additionalStyles={[styles.alignSelfCenter, !hovered && styles.opacitySemiTransparent]}
isButtonIcon
medium
/>
</View>
)}
</View>
{FooterComponent}
</PressableWithFeedback>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function BaseSelectionListItemRenderer<TItem extends ListItem>({
isUserValidated,
personalDetails,
userBillingFundID,
shouldShowRightCaret,
}: BaseSelectionListItemRendererProps<TItem>) {
const handleOnCheckboxPress = () => {
if (isTransactionGroupListItemType(item)) {
Expand Down Expand Up @@ -111,6 +112,7 @@ function BaseSelectionListItemRenderer<TItem extends ListItem>({
personalDetails={personalDetails}
userBillingFundID={userBillingFundID}
index={index}
shouldShowRightCaret={shouldShowRightCaret}
/>
{item.footerContent && item.footerContent}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ function BaseSelectionListWithSections<TItem extends ListItem>({
isSelected,
canShowProductTrainingTooltip,
renderScrollComponent,
shouldShowRightCaret,
ref,
}: SelectionListProps<TItem>) {
const styles = useThemeStyles();
Expand Down Expand Up @@ -680,6 +681,7 @@ function BaseSelectionListWithSections<TItem extends ListItem>({
singleExecution={singleExecution}
titleContainerStyles={listItemTitleContainerStyles}
canShowProductTrainingTooltip={canShowProductTrainingTooltipMemo}
shouldShowRightCaret={shouldShowRightCaret}
/>
</View>
);
Expand Down
2 changes: 2 additions & 0 deletions src/components/SelectionListWithSections/TableListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function TableListItem<TItem extends ListItem>({
shouldSyncFocus,
titleContainerStyles,
shouldUseDefaultRightHandSideCheckmark,
shouldShowRightCaret,
}: TableListItemProps<TItem>) {
const styles = useThemeStyles();
const theme = useTheme();
Expand Down Expand Up @@ -82,6 +83,7 @@ function TableListItem<TItem extends ListItem>({
shouldSyncFocus={shouldSyncFocus}
hoverStyle={item.isSelected && styles.activeComponentBG}
shouldUseDefaultRightHandSideCheckmark={shouldUseDefaultRightHandSideCheckmark}
shouldShowRightCaret={shouldShowRightCaret}
>
{(hovered) => (
<>
Expand Down
6 changes: 6 additions & 0 deletions src/components/SelectionListWithSections/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ type CommonListItemProps<TItem extends ListItem> = {

/** Callback to fire when the item is long pressed */
onLongPressRow?: (item: TItem) => void;

/** Whether to show the right caret */
shouldShowRightCaret?: boolean;
} & TRightHandSideComponent<TItem>;

type ListItemFocusEventHandler = (event: NativeSyntheticEvent<ExtendedTargetedEvent>) => void;
Expand Down Expand Up @@ -910,6 +913,9 @@ type SelectionListProps<TItem extends ListItem> = Partial<ChildrenProps> & {

/** Custom scroll component to use instead of the default ScrollView */
renderScrollComponent?: (props: ScrollViewProps) => ReactElement<ScrollViewProps, string | JSXElementConstructor<unknown>>;

/** Whether to show the right caret icon */
shouldShowRightCaret?: boolean;
} & TRightHandSideComponent<TItem>;

type SelectionListHandle = {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/workspace/WorkspaceMembersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ function WorkspaceMembersPage({personalDetails, route, policy}: WorkspaceMembers
canSelectMultiple={canSelectMultiple}
leftHeaderText={translate('common.member')}
rightHeaderText={translate('common.role')}
shouldShowRightCaret
/>
);
};
Expand Down Expand Up @@ -821,6 +822,7 @@ function WorkspaceMembersPage({personalDetails, route, policy}: WorkspaceMembers
listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]}
showScrollIndicator={false}
addBottomSafeAreaPadding
shouldShowRightCaret
/>
</>
)}
Expand Down
3 changes: 2 additions & 1 deletion src/pages/workspace/WorkspacesListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ function WorkspacesListPage() {
isDefault={isDefault}
isLoadingBill={isLoadingBill}
resetLoadingSpinnerIconIndex={resetLoadingSpinnerIconIndex}
isHovered={hovered}
/>
)}
</PressableWithoutFeedback>
Expand Down Expand Up @@ -474,7 +475,7 @@ function WorkspacesListPage() {
{translate('workspace.common.workspaceType')}
</Text>
</View>
<View style={[styles.workspaceRightColumn, styles.mr2]} />
<View style={[styles.workspaceRightColumn, styles.mr7]} />
</View>
)}
</>
Expand Down
15 changes: 15 additions & 0 deletions src/pages/workspace/WorkspacesListRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -128,6 +131,7 @@ function WorkspacesListRow({
isDefault,
isLoadingBill,
resetLoadingSpinnerIconIndex,
isHovered,
}: WorkspacesListRowProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
Expand Down Expand Up @@ -287,6 +291,17 @@ function WorkspacesListRow({
</View>

{!isNarrow && ThreeDotMenuOrPendingIcon}
{!isNarrow && (
<View style={[styles.justifyContentCenter, styles.alignItemsCenter, styles.mln4]}>
<Icon
src={Expensicons.ArrowRight}
fill={theme.icon}
additionalStyles={[styles.alignSelfCenter, !isHovered && styles.opacitySemiTransparent]}
isButtonIcon
medium
/>
</View>
)}
</Animated.View>
</View>
);
Expand Down
2 changes: 2 additions & 0 deletions src/pages/workspace/categories/WorkspaceCategoriesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ function WorkspaceCategoriesPage({route}: WorkspaceCategoriesPageProps) {
canSelectMultiple={canSelectMultiple}
leftHeaderText={translate('common.name')}
rightHeaderText={translate('common.enabled')}
shouldShowRightCaret
/>
);
};
Expand Down Expand Up @@ -592,6 +593,7 @@ function WorkspaceCategoriesPage({route}: WorkspaceCategoriesPageProps) {
listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]}
showScrollIndicator={false}
addBottomSafeAreaPadding
shouldShowRightCaret
/>
)}
{!hasVisibleCategories && !isLoading && inputValue.length === 0 && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function WorkspaceCompanyCardsList({cardsList, policyID, handleAssignCard, isDis
</Text>
<Text
numberOfLines={1}
style={[styles.textMicroSupporting, styles.lh16]}
style={[styles.textMicroSupporting, styles.lh16, styles.mr7]}
>
{translate('workspace.expensifyCard.lastFour')}
</Text>
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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 (
<View style={[styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter, styles.br3, styles.p4]}>
<View style={[styles.flexRow, styles.gap3, styles.alignItemsCenter, styles.flex3]}>
Expand Down Expand Up @@ -55,6 +58,15 @@ function WorkspaceCompanyCardsListRow({cardholder, name, cardNumber}: WorkspaceC
{cardNumber}
</Text>
</View>
<View style={[styles.justifyContentCenter, styles.alignItemsCenter, styles.ml2]}>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to consider the hover case here which caused #72565

<Icon
src={Expensicons.ArrowRight}
fill={theme.icon}
additionalStyles={[styles.alignSelfCenter]}
medium
isButtonIcon
/>
</View>
</View>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ function PolicyDistanceRatesPage({
canSelectMultiple={canSelectMultiple}
leftHeaderText={translate('workspace.distanceRates.rate')}
rightHeaderText={translate('common.enabled')}
shouldShowRightCaret
/>
);
};
Expand Down Expand Up @@ -509,6 +510,7 @@ function PolicyDistanceRatesPage({
shouldShowListEmptyContent={false}
listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]}
showScrollIndicator={false}
shouldShowRightCaret
/>
)}
<ConfirmModal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function WorkspaceCardListHeader({cardSettings}: WorkspaceCardListHeaderProps) {
{translate('workspace.expensifyCard.lastFour')}
</Text>
</View>
<View style={[styles.flexRow, shouldUseNarrowLayout ? styles.flex3 : styles.flex1, styles.gap2, styles.alignItemsCenter, styles.justifyContentEnd]}>
<View style={[styles.flexRow, shouldUseNarrowLayout ? styles.flex3 : styles.flex1, styles.gap2, styles.alignItemsCenter, styles.justifyContentEnd, styles.mr8]}>
<Text
numberOfLines={1}
style={[styles.textMicroSupporting, styles.lh16]}
Expand Down
17 changes: 14 additions & 3 deletions src/pages/workspace/expensifyCard/WorkspaceCardListRow.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React, {useMemo} from 'react';
import {View} from 'react-native';
import Avatar from '@components/Avatar';
import {FallbackAvatar} from '@components/Icon/Expensicons';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import {convertToShortDisplayString} from '@libs/CurrencyUtils';
import {getDisplayNameOrDefault} from '@libs/PersonalDetailsUtils';
Expand Down Expand Up @@ -35,14 +37,14 @@ function WorkspaceCardListRow({limit, cardholder, lastFourPAN, name, currency, i
const {shouldUseNarrowLayout} = useResponsiveLayout();
const styles = useThemeStyles();
const {translate} = useLocalize();

const theme = useTheme();
const cardholderName = useMemo(() => getDisplayNameOrDefault(cardholder), [cardholder]);
const cardType = isVirtual ? translate('workspace.expensifyCard.virtual') : translate('workspace.expensifyCard.physical');
return (
<View style={[styles.flexRow, styles.gap3, styles.br3, styles.p4]}>
<View style={[styles.flexRow, styles.flex4, styles.gap3, styles.alignItemsCenter]}>
<Avatar
source={cardholder?.avatar ?? FallbackAvatar}
source={cardholder?.avatar ?? Expensicons.FallbackAvatar}
avatarID={cardholder?.accountID}
type={CONST.ICON_TYPE_AVATAR}
size={CONST.AVATAR_SIZE.DEFAULT}
Expand Down Expand Up @@ -112,6 +114,15 @@ function WorkspaceCardListRow({limit, cardholder, lastFourPAN, name, currency, i
</Text>
)}
</View>
<View style={[styles.justifyContentCenter, styles.alignItemsCenter]}>
<Icon
src={Expensicons.ArrowRight}
fill={theme.icon}
additionalStyles={[styles.alignSelfCenter]}
medium
isButtonIcon
/>
</View>
</View>
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/pages/workspace/perDiem/WorkspacePerDiemPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) {
return null;
}
const header = (
<View style={[styles.flex1, styles.flexRow, styles.justifyContentBetween, canSelectMultiple && styles.pl3]}>
<View style={[styles.flex1, styles.flexRow, styles.justifyContentBetween, canSelectMultiple && styles.pl3, styles.mr6]}>
<View style={styles.flex3}>
<Text style={[styles.textMicroSupporting, styles.alignSelfStart]}>{translate('common.destination')}</Text>
</View>
Expand Down Expand Up @@ -458,6 +458,7 @@ function WorkspacePerDiemPage({route}: WorkspacePerDiemPageProps) {
listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]}
listItemTitleContainerStyles={styles.flex3}
showScrollIndicator={false}
shouldShowRightCaret
/>
)}
{!hasVisibleSubRates && !isLoading && (
Expand Down
2 changes: 2 additions & 0 deletions src/pages/workspace/reports/ReportFieldsListValuesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ function ReportFieldsListValuesPage({
canSelectMultiple={canSelectMultiple}
leftHeaderText={translate('common.name')}
rightHeaderText={translate('common.enabled')}
shouldShowRightCaret
/>
);
};
Expand Down Expand Up @@ -402,6 +403,7 @@ function ReportFieldsListValuesPage({
shouldPreventDefaultFocusOnSelectRow={!canUseTouchScreen()}
listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]}
showScrollIndicator={false}
shouldShowRightCaret
/>
)}
<ConfirmModal
Expand Down
Loading