Skip to content

Commit

Permalink
include title in Next Steps (?)
Browse files Browse the repository at this point in the history
  • Loading branch information
grgia committed Aug 21, 2024
1 parent 5e6fe53 commit 9489e15
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
const hasOnlyPendingTransactions = ReportUtils.getTransactionsWithReceipts(moneyRequestReport?.reportID).every(
(t) => TransactionUtils.isExpensifyCardTransaction(t) && TransactionUtils.isPending(t),
);
const hasOnlyPostedTransactions = allTransactions.every(

Check failure on line 112 in src/components/MoneyReportHeader.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

'hasOnlyPostedTransactions' is assigned a value but never used
(transaction) => !TransactionUtils.getReimbursable(transaction) && !TransactionUtils.isPending(transaction) && !TransactionUtils.isReceiptBeingScanned(transaction),

Check failure on line 113 in src/components/MoneyReportHeader.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

'transaction' is already declared in the upper scope on line 76 column 11
);

const transactionIDs = allTransactions.map((t) => t.transactionID);
const allHavePendingRTERViolation = TransactionUtils.allHavePendingRTERViolation(transactionIDs);
const hasOnlyHeldExpenses = ReportUtils.hasOnlyHeldExpenses(moneyRequestReport.reportID);
Expand Down
3 changes: 2 additions & 1 deletion src/components/MoneyReportHeaderStatusBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ function MoneyReportHeaderStatusBar({nextStep}: MoneyReportHeaderStatusBarProps)
const theme = useTheme();
const messageContent = useMemo(() => {
const messageArray = nextStep.message;
return NextStepUtils.parseMessage(messageArray);
const title = nextStep.title ?? '';
return NextStepUtils.parseMessage(messageArray, title);
}, [nextStep.message]);

Check warning on line 35 in src/components/MoneyReportHeaderStatusBar.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

React Hook useMemo has a missing dependency: 'nextStep.title'. Either include it or remove the dependency array

return (
Expand Down
5 changes: 2 additions & 3 deletions src/libs/NextStepUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Onyx.connect({
callback: (value) => (allPolicies = value),
});

function parseMessage(messages: Message[] | undefined) {
function parseMessage(messages: Message[] | undefined, title: string | undefined) {
let nextStepHTML = '';

messages?.forEach((part) => {
Expand All @@ -48,8 +48,7 @@ function parseMessage(messages: Message[] | undefined) {
tagType = 'next-step-email';
content = EmailUtils.prefixMailSeparatorsWithBreakOpportunities(content);
}

nextStepHTML += `<${tagType}>${content}</${tagType}>`;
nextStepHTML += `<${tagType}>${[title, content].join(' ')}</${tagType}>`;
});

const formattedHtml = nextStepHTML
Expand Down
3 changes: 3 additions & 0 deletions src/types/onyx/ReportNextStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ type ReportNextStep = {
/** The message parts of the next step */
message?: Message[];

/** The tile the next step */
title?: string;

/** The icon for the next step */
icon: ValueOf<typeof CONST.NEXT_STEP.ICONS>;

Expand Down

0 comments on commit 9489e15

Please sign in to comment.