Skip to content

Commit

Permalink
Add types and comments
Browse files Browse the repository at this point in the history
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
  • Loading branch information
tsa321 committed Jul 25, 2024
1 parent 4ecdfaa commit 1c26ea4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/LHNOptionsList/LHNOptionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import * as DraftCommentUtils from '@libs/DraftCommentUtils';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import * as OptionsListUtils from '@libs/OptionsListUtils';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -121,7 +121,7 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio
const itemParentReportAction = itemParentReportActions?.[itemFullReport?.parentReportActionID ?? '-1'];

const iouReportIDOfLastAction = OptionsListUtils.getIOUReportIDOfLastAction(itemFullReport);
const itemIouReportReportActions = !!iouReportIDOfLastAction ? reportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportIDOfLastAction}`] : undefined;
const itemIouReportReportActions = iouReportIDOfLastAction ? reportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportIDOfLastAction}`] : undefined;

const itemPolicy = policy?.[`${ONYXKEYS.COLLECTION.POLICY}${itemFullReport?.policyID}`];
const transactionID = ReportActionsUtils.isMoneyRequestAction(itemParentReportAction)
Expand Down
3 changes: 3 additions & 0 deletions src/components/LHNOptionsList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ type OptionRowLHNDataProps = {
/** Array of report actions for this report */
reportActions: OnyxEntry<ReportActions>;

/** Array of report actions of IOU report related to this report last action */
iouReportReportActions: OnyxEntry<ReportActions>;

/** List of transaction violation */
transactionViolations: OnyxCollection<TransactionViolation[]>;

Expand Down
8 changes: 7 additions & 1 deletion src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,13 @@ function isSearchStringMatchUserDetails(personalDetail: PersonalDetails, searchV
return isSearchStringMatch(searchValue.trim(), memberDetails.toLowerCase());
}

function getIOUReportIDOfLastAction(report) {
/**
* Get IOU report ID of report last action if the action is report action preview
*/
function getIOUReportIDOfLastAction(report: OnyxEntry<Report>): string | undefined {
if (!report?.reportID) {
return;
}
const lastAction = visibleReportActionItems[report.reportID];
if (!ReportActionUtils.isReportPreviewAction(lastAction)) {
return;
Expand Down

0 comments on commit 1c26ea4

Please sign in to comment.