Skip to content

Commit

Permalink
Receipt audit design updates.
Browse files Browse the repository at this point in the history
Signed-off-by: Krishna Gupta <[email protected]>
  • Loading branch information
Krishna2323 committed Mar 22, 2024
1 parent 25cc0fa commit da3ae8c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 36 deletions.
29 changes: 17 additions & 12 deletions src/components/ReceiptAudit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,37 @@ import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import Text from './Text';

function ReceiptAuditHeader({notes = []}: {notes?: string[]}) {
function ReceiptAuditHeader({notes = [], showAuditMessage = false}: {notes?: string[]; showAuditMessage?: boolean}) {
const styles = useThemeStyles();
const theme = useTheme();
const {translate} = useLocalize();

const issuesFoundText = notes.length > 0 ? translate('iou.receiptIssuesFound', notes.length) : translate('iou.receiptNoIssuesFound');
const issuesFoundText = notes.length > 0 ? translate('iou.receiptIssuesFound', notes.length) : translate('common.verified');
return (
<View style={[styles.ph5]}>
<View style={[styles.ph5, styles.mbn1]}>
<View style={[styles.flexRow, styles.alignItemsCenter]}>
<Text style={[styles.textLabelSupporting]}>{translate('common.receipt')}</Text>
<Text style={[styles.textLabelSupporting]}>{` • ${issuesFoundText}`}</Text>
<Icon
width={12}
height={12}
src={notes.length > 0 ? Expensicons.DotIndicator : Expensicons.Checkmark}
fill={notes.length ? theme.danger : theme.success}
additionalStyles={styles.ml2}
/>
{showAuditMessage && (
<>
<Text style={[styles.textLabelSupporting, styles.textLarge]}>{' • '}</Text>
<Text style={[styles.textLabelSupporting]}>{`${issuesFoundText}`}</Text>
<Icon
width={12}
height={12}
src={notes.length > 0 ? Expensicons.DotIndicator : Expensicons.Checkmark}
fill={notes.length ? theme.danger : theme.success}
additionalStyles={styles.ml1}
/>
</>
)}
</View>
</View>
);
}

function ReceiptAuditMessages({notes = []}: {notes?: string[]}) {
const styles = useThemeStyles();
return <View style={[styles.mt1, styles.mb2, styles.ph5, {gap: 6}]}>{notes.length > 0 && notes.map((message) => <Text style={[styles.textLabelError]}>{message}</Text>)}</View>;
return <View style={[styles.mtn1, styles.mb2, styles.ph5, styles.gap1]}>{notes.length > 0 && notes.map((message) => <Text style={[styles.textLabelError]}>{message}</Text>)}</View>;
}

export {ReceiptAuditHeader, ReceiptAuditMessages};
10 changes: 7 additions & 3 deletions src/components/ReportActionItem/MoneyRequestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,12 @@ function MoneyRequestView({
<View style={[StyleUtils.getReportWelcomeContainerStyle(isSmallScreenWidth)]}>
<AnimatedEmptyStateBackground />
<View style={[StyleUtils.getReportWelcomeTopMarginStyle(isSmallScreenWidth)]}>
{shouldShowNotesViolations && <ReceiptAuditHeader notes={noteTypeViolations} />}
{/* eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing */}
{hasReceipt && (
<ReceiptAuditHeader
notes={noteTypeViolations}
showAuditMessage={shouldShowNotesViolations}
/>
)}
{(showMapAsImage || hasReceipt) && (

Check failure on line 253 in src/components/ReportActionItem/MoneyRequestView.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator
<OfflineWithFeedback
pendingAction={pendingAction}
Expand Down Expand Up @@ -291,7 +295,7 @@ function MoneyRequestView({
/>
)}
{shouldShowNotesViolations && <ReceiptAuditMessages notes={noteTypeViolations} />}
{canUseViolations && <ViolationMessages violations={getViolationsForField('receipt')} />}
<ViolationMessages violations={getViolationsForField('receipt')} />
<OfflineWithFeedback pendingAction={getPendingFieldAction('amount')}>
<MenuItemWithTopDescription
title={formattedTransactionAmount ? formattedTransactionAmount.toString() : ''}
Expand Down
6 changes: 2 additions & 4 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ export default {
nonBillable: 'Non-billable',
tag: 'Tag',
receipt: 'Receipt',
verified: `Verified`,
replace: 'Replace',
distance: 'Distance',
mile: 'mile',
Expand Down Expand Up @@ -602,10 +603,7 @@ export default {
posted: 'Posted',
deleteReceipt: 'Delete receipt',
routePending: 'Route pending...',
receiptAudit: 'Receipt Audit',
receiptVerified: 'Receipt Verified',
receiptNoIssuesFound: 'No issues found',
receiptIssuesFound: (count: number) => `${count} ${count === 1 ? 'issue' : 'issues'} found`,
receiptIssuesFound: (count: number) => `${count === 1 ? 'Issue' : 'Issues'} found`,
receiptScanning: 'Scan in progress…',
receiptMissingDetails: 'Receipt missing details',
missingAmount: 'Missing amount',
Expand Down
6 changes: 2 additions & 4 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ export default {
nonBillable: 'No facturable',
tag: 'Etiqueta',
receipt: 'Recibo',
verified: `Verificado`,
replace: 'Sustituir',
distance: 'Distancia',
mile: 'milla',
Expand Down Expand Up @@ -595,10 +596,7 @@ export default {
posted: 'Contabilizado',
deleteReceipt: 'Eliminar recibo',
routePending: 'Ruta pendiente...',
receiptAudit: 'Auditoría de recibos',
receiptVerified: 'Recibo verificado',
receiptNoIssuesFound: 'No se encontraron problemas',
receiptIssuesFound: (count: number) => `Se encontró ${count} ${count === 1 ? 'problema' : 'problemas'}`,
receiptIssuesFound: (count: number) => `${count === 1 ? 'Problema' : 'Problemas'}`,
receiptScanning: 'Escaneo en curso…',
receiptMissingDetails: 'Recibo con campos vacíos',
missingAmount: 'Falta importe',
Expand Down
13 changes: 0 additions & 13 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4225,19 +4225,6 @@ const styles = (theme: ThemeColors) =>
borderWidth: 1,
},

receiptAuditTitleContainer: {
flexDirection: 'row',
gap: 4,
padding: 4,
paddingHorizontal: 8,
height: variables.inputHeightSmall,
borderRadius: variables.componentBorderRadiusSmall,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: theme.border,
},

mapViewContainer: {
...flex.flex1,
minHeight: 300,
Expand Down

0 comments on commit da3ae8c

Please sign in to comment.