Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add Type column to workspace feeds #51946

Merged
merged 6 commits into from
Nov 7, 2024
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
12 changes: 11 additions & 1 deletion src/pages/workspace/expensifyCard/WorkspaceCardListHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,17 @@ function WorkspaceCardListHeader({policyID}: WorkspaceCardListHeaderProps) {
{translate('workspace.expensifyCard.name')}
</Text>
</View>
<View style={[styles.flexRow, styles.gap2, shouldUseNarrowLayout ? styles.flex2 : styles.flex1, styles.alignItemsCenter, styles.justifyContentEnd]}>
{!shouldUseNarrowLayout && (
<View style={[styles.flexRow, styles.gap2, styles.flex1, styles.alignItemsCenter, styles.justifyContentStart]}>
<Text
numberOfLines={1}
style={[styles.textLabelSupporting, styles.lh16]}
>
{translate('common.type')}
</Text>
</View>
)}
<View style={[styles.flexRow, styles.gap2, shouldUseNarrowLayout ? styles.flex2 : styles.flex1, styles.alignItemsCenter, styles.justifyContentStart]}>
<Text
numberOfLines={1}
style={[styles.textLabelSupporting, styles.lh16]}
Expand Down
51 changes: 44 additions & 7 deletions src/pages/workspace/expensifyCard/WorkspaceCardListRow.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, {useMemo} from 'react';
import {View} from 'react-native';
import Avatar from '@components/Avatar';
import Badge from '@components/Badge';
import {FallbackAvatar} from '@components/Icon/Expensicons';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import * as CurrencyUtils from '@libs/CurrencyUtils';
Expand All @@ -26,14 +26,18 @@ type WorkspacesListRowProps = {

/** Policy currency */
currency: string;

/** Type of card */
isVirtual: boolean;
};

function WorkspaceCardListRow({limit, cardholder, lastFourPAN, name, currency}: WorkspacesListRowProps) {
function WorkspaceCardListRow({limit, cardholder, lastFourPAN, name, currency, isVirtual}: WorkspacesListRowProps) {
const {shouldUseNarrowLayout} = useResponsiveLayout();
const styles = useThemeStyles();
const {translate} = useLocalize();

const cardholderName = useMemo(() => PersonalDetailsUtils.getDisplayNameOrDefault(cardholder), [cardholder]);

const cardType = isVirtual ? translate('workspace.expensifyCard.virtual') : translate('workspace.expensifyCard.physical');
return (
<View style={[styles.flexRow, styles.gap5, styles.br3, styles.p4]}>
<View style={[styles.flexRow, styles.flex5, styles.gap3, styles.alignItemsCenter]}>
Expand All @@ -58,16 +62,49 @@ function WorkspaceCardListRow({limit, cardholder, lastFourPAN, name, currency}:
</Text>
</View>
</View>
<View style={[styles.flexRow, styles.gap2, shouldUseNarrowLayout ? styles.flex2 : styles.flex1, styles.alignItemsCenter, styles.justifyContentEnd]}>
{!shouldUseNarrowLayout && (
<View style={[styles.flexRow, styles.gap2, styles.flex1, styles.alignItemsCenter, styles.justifyContentStart]}>
<Text
numberOfLines={1}
style={[styles.textNormalThemeText]}
>
{cardType}
</Text>
</View>
)}
<View style={[styles.flexRow, styles.gap2, shouldUseNarrowLayout ? styles.flex2 : styles.flex1, styles.alignItemsCenter, styles.justifyContentStart]}>
<Text
numberOfLines={1}
style={[styles.textLabelSupporting, styles.lh16]}
style={[styles.textNormalThemeText]}
>
{lastFourPAN}
</Text>
</View>
<View style={[styles.flexRow, shouldUseNarrowLayout ? styles.flex3 : styles.flex1, styles.gap2, styles.alignItemsCenter, styles.justifyContentEnd]}>
<Badge text={CurrencyUtils.convertToDisplayString(limit, currency)} />
<View
style={[
!shouldUseNarrowLayout ? styles.flexRow : styles.flexColumn,
shouldUseNarrowLayout ? styles.flex3 : styles.flex1,
!shouldUseNarrowLayout && styles.gap2,
!shouldUseNarrowLayout ? styles.alignItemsCenter : styles.alignItemsEnd,
styles.justifyContentEnd,
]}
>
<Text
numberOfLines={1}
style={[styles.textNormalThemeText]}
>
{CurrencyUtils.convertToDisplayString(limit, currency)}
</Text>
{shouldUseNarrowLayout && (
<View style={[styles.flexRow, styles.gap2, styles.flex1, styles.alignItemsCenter, styles.justifyContentStart]}>
<Text
numberOfLines={1}
style={[styles.textLabelSupporting]}
>
{cardType}
</Text>
</View>
)}
</View>
</View>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ function WorkspaceExpensifyCardListPage({route, cardsList}: WorkspaceExpensifyCa
limit={item.nameValuePairs?.unapprovedExpenseLimit ?? 0}
name={item.nameValuePairs?.cardTitle ?? ''}
currency={policyCurrency}
isVirtual={!!item.nameValuePairs?.isVirtual}
mountiny marked this conversation as resolved.
Show resolved Hide resolved
/>
</PressableWithFeedback>
</OfflineWithFeedback>
Expand Down
Loading