Skip to content

Commit 4ed9165

Browse files
Show Unreported status badge for expenses without a report
When expenses in personal chat are not yet reported, the Status column shows empty cells because stateNum/statusNum are undefined. Change the fallback in getReportStatusTranslation and getReportStatusColorStyle to return an "Unreported" badge instead of empty values. Add the unreported badge style to both light and dark themes. Co-authored-by: Jayesh Mangwani <jayeshmangwani@users.noreply.github.com>
1 parent fdb0b0f commit 4ed9165

5 files changed

Lines changed: 15 additions & 7 deletions

File tree

src/libs/ReportUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13207,7 +13207,7 @@ function getReportStatusTranslation({stateNum, statusNum, isDeleted, translate}:
1320713207
return translate('iou.deleted');
1320813208
}
1320913209
if (stateNum === undefined || statusNum === undefined) {
13210-
return '';
13210+
return translate('common.unreported');
1321113211
}
1321213212

1321313213
if (stateNum === CONST.REPORT.STATE_NUM.OPEN && statusNum === CONST.REPORT.STATUS_NUM.OPEN) {
@@ -13238,7 +13238,7 @@ function getReportStatusColorStyle(theme: ThemeColors, stateNum?: number, status
1323813238
return theme.reportStatusBadge.deleted;
1323913239
}
1324013240
if (stateNum === undefined || statusNum === undefined) {
13241-
return undefined;
13241+
return theme.reportStatusBadge.unreported;
1324213242
}
1324313243

1324413244
if (stateNum === CONST.REPORT.STATE_NUM.OPEN && statusNum === CONST.REPORT.STATUS_NUM.OPEN) {

src/styles/theme/themes/dark.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ const darkTheme = {
197197
backgroundColor: colors.tangerine700,
198198
textColor: colors.productDark900,
199199
},
200+
unreported: {
201+
backgroundColor: colors.productDark400,
202+
textColor: colors.productDark800,
203+
},
200204
},
201205

202206
statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT,

src/styles/theme/themes/light.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ const lightTheme = {
197197
backgroundColor: colors.tangerine500,
198198
textColor: colors.productLight100,
199199
},
200+
unreported: {
201+
backgroundColor: colors.productLight400,
202+
textColor: colors.productLight800,
203+
},
200204
},
201205

202206
statusBarStyle: CONST.STATUS_BAR_STYLE.DARK_CONTENT,

src/styles/theme/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ type ThemeColors = {
119119
trialTimer: Color;
120120

121121
reportStatusBadge: Record<
122-
'draft' | 'outstanding' | 'paid' | 'approved' | 'closed' | 'deleted',
122+
'draft' | 'outstanding' | 'paid' | 'approved' | 'closed' | 'deleted' | 'unreported',
123123
{
124124
backgroundColor: Color;
125125
textColor: Color;

tests/unit/ReportUtilsTest.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10565,10 +10565,10 @@ describe('ReportUtils', () => {
1056510565
expect(result).toBe(mockTranslate('iou.settledExpensify'));
1056610566
});
1056710567

10568-
it('should return an empty string when stateNum or statusNum is undefined', () => {
10569-
expect(getReportStatusTranslation({stateNum: undefined, statusNum: undefined, translate: mockTranslate})).toBe('');
10570-
expect(getReportStatusTranslation({stateNum: CONST.REPORT.STATE_NUM.OPEN, statusNum: undefined, translate: mockTranslate})).toBe('');
10571-
expect(getReportStatusTranslation({stateNum: undefined, statusNum: CONST.REPORT.STATUS_NUM.OPEN, translate: mockTranslate})).toBe('');
10568+
it('should return "Unreported" when stateNum or statusNum is undefined', () => {
10569+
expect(getReportStatusTranslation({stateNum: undefined, statusNum: undefined, translate: mockTranslate})).toBe(mockTranslate('common.unreported'));
10570+
expect(getReportStatusTranslation({stateNum: CONST.REPORT.STATE_NUM.OPEN, statusNum: undefined, translate: mockTranslate})).toBe(mockTranslate('common.unreported'));
10571+
expect(getReportStatusTranslation({stateNum: undefined, statusNum: CONST.REPORT.STATUS_NUM.OPEN, translate: mockTranslate})).toBe(mockTranslate('common.unreported'));
1057210572
});
1057310573

1057410574
it('should return "Deleted" when isDeleted is true', () => {

0 commit comments

Comments
 (0)