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

(2/2) Add support for all reportAction types in ChatListItem - use PureReportActionItem in ChatListItem #54228

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
eea0421
WIP use PureReportActionItem in ChatListItem
wildan-m Nov 23, 2024
e0f2a61
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Dec 16, 2024
5808732
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Dec 17, 2024
639b413
Pass personalDetails to ReportActionItemSingle
wildan-m Dec 17, 2024
7dc43b4
WIP, override contextvalue from search page
wildan-m Dec 17, 2024
0d0c33a
WIP, adjust wrapper layout and memo condition
wildan-m Dec 18, 2024
6247a8a
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Dec 18, 2024
4e7018f
fill actorAccountID for search chatitemlist
wildan-m Dec 18, 2024
2e96dbe
Lint and prettier
wildan-m Dec 18, 2024
4f5207a
fix lint
wildan-m Dec 18, 2024
2c0ee75
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Dec 19, 2024
8d64fba
resolve eslint error
wildan-m Dec 19, 2024
273f76c
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Dec 20, 2024
ee5de13
revert contextOverride props
wildan-m Dec 20, 2024
45d68c5
remove unnecessary code
wildan-m Dec 20, 2024
5046a48
add attachmentContextValueType
wildan-m Dec 20, 2024
faaa140
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Dec 21, 2024
c4145e6
add missing dependency
wildan-m Dec 21, 2024
220b657
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Dec 23, 2024
35f99be
remove unused import, fix lint
wildan-m Dec 23, 2024
d7d9818
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Dec 24, 2024
f55cff9
Remove unnecessary code
wildan-m Dec 24, 2024
45b406f
Mock ConfirmedRoute to get rid map error
wildan-m Dec 26, 2024
299992e
mock ConfirmedRoute to test
wildan-m Dec 27, 2024
8d74ba2
Resolve issue with unit test
wildan-m Dec 27, 2024
340bee5
remove unnecessary code
wildan-m Dec 27, 2024
e7d801c
resolve jest perf test error
wildan-m Dec 27, 2024
b189a00
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Dec 28, 2024
760ca69
fix lint error
wildan-m Dec 28, 2024
2705f78
mock ConfirmedRoute on selectionlist perf test
wildan-m Dec 28, 2024
135c677
fix issue image not found in desktop
wildan-m Dec 28, 2024
6f59803
revert unnecessary change
wildan-m Dec 28, 2024
974d5b8
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Dec 30, 2024
055a263
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Dec 31, 2024
0a1044a
extract policy object to param
wildan-m Dec 31, 2024
a361dcb
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Jan 4, 2025
ba54e4e
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Jan 8, 2025
0fc3a45
insert personal details to ReportActionItemSingle
wildan-m Jan 8, 2025
e51cf56
extract invoiceReceiverPolicy
wildan-m Jan 8, 2025
6997752
extract IOUTransaction from reportactionitemcontentcreated
wildan-m Jan 8, 2025
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
111 changes: 28 additions & 83 deletions src/components/SelectionList/ChatListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import React, {useMemo} from 'react';
import {View} from 'react-native';
import {AttachmentContext} from '@components/AttachmentContext';
import MentionReportContext from '@components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/MentionReportContext';
import MultipleAvatars from '@components/MultipleAvatars';
import {ShowContextMenuContext} from '@components/ShowContextMenuContext';
import TextWithTooltip from '@components/TextWithTooltip';
import React from 'react';
import useAnimatedHighlightStyle from '@hooks/useAnimatedHighlightStyle';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import ReportActionItemDate from '@pages/home/report/ReportActionItemDate';
import ReportActionItemFragment from '@pages/home/report/ReportActionItemFragment';
import PureReportActionItem from '@pages/home/report/PureReportActionItem';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import type {SearchPersonalDetails} from '@src/types/onyx/SearchResults';
import BaseListItem from './BaseListItem';
import type {ChatListItemProps, ListItem, ReportActionListItemType} from './types';

Expand All @@ -30,34 +23,9 @@ function ChatListItem<TItem extends ListItem>({
}: ChatListItemProps<TItem>) {
const reportActionItem = item as unknown as ReportActionListItemType;
const from = reportActionItem.from;
const icons = [
{
type: CONST.ICON_TYPE_AVATAR,
source: from.avatar,
name: reportActionItem.formattedFrom,
id: from.accountID,
},
];
const styles = useThemeStyles();
const theme = useTheme();
const StyleUtils = useStyleUtils();

const attachmentContextValue = {type: CONST.ATTACHMENT_TYPE.SEARCH};

const contextValue = {
anchor: null,
report: undefined,
reportNameValuePairs: undefined,
action: undefined,
transactionThreadReport: undefined,
checkIfContextMenuActive: () => {},
isDisabled: true,
};

const focusedBackgroundColor = styles.sidebarLinkActive.backgroundColor;
const hoveredBackgroundColor = styles.sidebarLinkHover?.backgroundColor ? styles.sidebarLinkHover.backgroundColor : theme.sidebar;

const mentionReportContextValue = useMemo(() => ({currentReportID: item?.reportID ?? '-1'}), [item.reportID]);
const animatedHighlightStyle = useAnimatedHighlightStyle({
borderRadius: variables.componentBorderRadius,
shouldHighlight: item?.shouldAnimateInHighlight ?? false,
Expand All @@ -66,6 +34,7 @@ function ChatListItem<TItem extends ListItem>({
});
const pressableStyle = [
styles.selectionListPressableItemWrapper,
styles.p0,
styles.textAlignLeft,
styles.overflowHidden,
// Removing background style because they are added to the parent OpacityView via animatedHighlightStyle
Expand All @@ -74,11 +43,16 @@ function ChatListItem<TItem extends ListItem>({
styles.mh0,
item.cursorStyle,
];

const personalDetails: Record<string, SearchPersonalDetails | null> = {
[from.accountID]: from,
};

return (
<BaseListItem
item={item}
pressableStyle={pressableStyle}
wrapperStyle={[styles.flexRow, styles.flex1, styles.justifyContentBetween, styles.userSelectNone]}
wrapperStyle={[styles.flex1, styles.justifyContentBetween, styles.userSelectNone]}
containerStyle={styles.mb2}
isFocused={isFocused}
isDisabled={isDisabled}
Expand All @@ -95,53 +69,24 @@ function ChatListItem<TItem extends ListItem>({
pressableWrapperStyle={[styles.mh5, animatedHighlightStyle]}
hoverStyle={item.isSelected && styles.activeComponentBG}
>
{(hovered) => (
<MentionReportContext.Provider value={mentionReportContextValue}>
<ShowContextMenuContext.Provider value={contextValue}>
<AttachmentContext.Provider value={attachmentContextValue}>
<MultipleAvatars
icons={icons}
shouldShowTooltip={showTooltip}
secondAvatarStyle={[
StyleUtils.getBackgroundAndBorderStyle(theme.sidebar),
isFocused ? StyleUtils.getBackgroundAndBorderStyle(focusedBackgroundColor) : undefined,
hovered && !isFocused ? StyleUtils.getBackgroundAndBorderStyle(hoveredBackgroundColor) : undefined,
]}
/>
<View style={[styles.chatItemRight]}>
<View style={[styles.chatItemMessageHeader]}>
<View style={[styles.flexShrink1, styles.mr1]}>
<TextWithTooltip
shouldShowTooltip={showTooltip}
text={reportActionItem.formattedFrom}
style={[
styles.chatItemMessageHeaderSender,
isFocused ? styles.sidebarLinkActiveText : styles.sidebarLinkText,
styles.sidebarLinkTextBold,
styles.pre,
]}
/>
</View>
<ReportActionItemDate created={reportActionItem.created ?? ''} />
</View>
<View style={styles.chatItemMessage}>
{reportActionItem.message.map((fragment, index) => (
<ReportActionItemFragment
// eslint-disable-next-line react/no-array-index-key
key={`actionFragment-${reportActionItem.reportActionID}-${index}`}
fragment={fragment}
actionName={reportActionItem.actionName}
source=""
accountID={from.accountID}
isFragmentContainingDisplayName={index === 0}
/>
))}
</View>
</View>
</AttachmentContext.Provider>
</ShowContextMenuContext.Provider>
</MentionReportContext.Provider>
)}
<PureReportActionItem
action={reportActionItem}
onPress={() => onSelectRow(item)}
report={undefined}
reportActions={[]}
parentReportAction={undefined}
displayAsGroup={false}
isMostRecentIOUReportAction={false}
shouldDisplayNewMarker={false}
index={item.index ?? 0}
isFirstVisibleReportAction={false}
personalDetails={personalDetails}
shouldDisplayContextMenu={false}
attachmentContextValueType={CONST.ATTACHMENT_TYPE.SEARCH}
policy={undefined}
invoiceReceiverPolicy={undefined}
IOUTransaction={undefined}
/>
</BaseListItem>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ const unavailableTranslation = Localize.translateLocal('workspace.common.unavail
*/
function getPolicyName(report: OnyxInputOrEntry<Report>, returnEmptyIfNotFound = false, policy?: OnyxInputOrEntry<Policy>): string {
const noPolicyFound = returnEmptyIfNotFound ? '' : unavailableTranslation;
if (isEmptyObject(report) || (isEmptyObject(allPolicies) && !report?.policyName)) {
if (isEmptyObject(report) || (isEmptyObject(allPolicies) && !report?.policyName && !policy)) {
return noPolicyFound;
}

Expand Down
38 changes: 31 additions & 7 deletions src/pages/home/report/PureReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,17 @@

/** A message related to a report action that has been automatically forwarded */
reportAutomaticallyForwardedMessage?: string;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't comment on the line, but ReportPreview in line 736 is still directly connected to Onyx, which means it doesn't show correct report data, e.g.

Screen.Recording.2024-12-31.at.3.21.29.PM.mov

/** Type of attachment context value */
attachmentContextValueType?: ValueOf<typeof CONST.ATTACHMENT_TYPE>;

/** Current connected policy */
policy: OnyxEntry<OnyxTypes.Policy>;

/** Invoice receiver policy */
invoiceReceiverPolicy: OnyxEntry<OnyxTypes.Policy>;

IOUTransaction: OnyxEntry<OnyxTypes.Transaction>;
};

/**
Expand All @@ -264,7 +275,7 @@
isThreadReportParentAction = false,
shouldUseThreadDividerLine = false,
shouldDisplayContextMenu = true,
parentReportActionForTransactionThread,

Check failure on line 278 in src/pages/home/report/PureReportActionItem.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

'parentReportActionForTransactionThread' is defined but never used

Check failure on line 278 in src/pages/home/report/PureReportActionItem.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'parentReportActionForTransactionThread' is defined but never used
draftMessage,
iouReport,
emojiReactions,
Expand Down Expand Up @@ -293,10 +304,14 @@
dismissTrackExpenseActionableWhisper = () => {},
userBillingFundID,
reportAutomaticallyForwardedMessage,
attachmentContextValueType = CONST.ATTACHMENT_TYPE.REPORT,
policy,
invoiceReceiverPolicy,
IOUTransaction,
}: PureReportActionItemProps) {
const {translate} = useLocalize();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const reportID = report?.reportID ?? '';
const reportID = report?.reportID ?? action?.reportID ?? '';
const theme = useTheme();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
Expand Down Expand Up @@ -517,9 +532,14 @@
[report, action, toggleContextMenuFromActiveReportAction, transactionThreadReport, reportNameValuePairs],
);

const attachmentContextValue = useMemo(() => ({reportID, type: CONST.ATTACHMENT_TYPE.REPORT}), [reportID]);
const attachmentContextValue = useMemo(() => {
if (attachmentContextValueType === CONST.ATTACHMENT_TYPE.SEARCH) {
return {type: attachmentContextValueType};
}
return {reportID, type: attachmentContextValueType};
}, [reportID, attachmentContextValueType]);

const mentionReportContextValue = useMemo(() => ({currentReportID: report?.reportID ?? '-1'}), [report?.reportID]);
const mentionReportContextValue = useMemo(() => ({currentReportID: reportID ?? '-1'}), [reportID]);

const actionableItemButtons: ActionableItem[] = useMemo(() => {
if (ReportActionsUtils.isActionableAddPaymentCard(action) && userBillingFundID === undefined && shouldRenderAddPaymentCard()) {
Expand Down Expand Up @@ -1000,6 +1020,9 @@
![CONST.MODERATION.MODERATOR_DECISION_APPROVED, CONST.MODERATION.MODERATOR_DECISION_PENDING].some((item) => item === moderationDecision) &&
!ReportActionsUtils.isPendingRemove(action)
}
personalDetails={personalDetails}
policy={policy}
invoiceReceiverPolicy={invoiceReceiverPolicy}
>
{content}
</ReportActionItemSingle>
Expand All @@ -1010,17 +1033,18 @@
};

if (action.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED) {
const transactionID = ReportActionsUtils.isMoneyRequestAction(parentReportActionForTransactionThread)
? ReportActionsUtils.getOriginalMessage(parentReportActionForTransactionThread)?.IOUTransactionID
: '-1';
// const transactionID = ReportActionsUtils.isMoneyRequestAction(parentReportActionForTransactionThread)
// ? ReportActionsUtils.getOriginalMessage(parentReportActionForTransactionThread)?.IOUTransactionID
// : '-1';

return (
<ReportActionItemContentCreated
contextValue={contextValue}
parentReportAction={parentReportAction}
transactionID={transactionID}
transaction={IOUTransaction}
draftMessage={draftMessage}
shouldHideThreadDividerLine={shouldHideThreadDividerLine}
invoiceReceiverPolicy={invoiceReceiverPolicy}
/>
);
}
Expand Down
17 changes: 15 additions & 2 deletions src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
import {useOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import {useBlockedFromConcierge, usePersonalDetails} from '@components/OnyxProvider';
import usePolicy from '@hooks/usePolicy';
import ModifiedExpenseMessage from '@libs/ModifiedExpenseMessage';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import * as ReportUtils from '@libs/ReportUtils';
import * as Report from '@userActions/Report';
import * as ReportActions from '@userActions/ReportActions';
import * as Transaction from '@userActions/Transaction';
import type CONST from '@src/CONST';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {ReportAction} from '@src/types/onyx';
import type {PureReportActionItemProps} from './PureReportActionItem';
import PureReportActionItem from './PureReportActionItem';

function ReportActionItem({action, report, ...props}: PureReportActionItemProps) {
function ReportActionItem({action, report, parentReportActionForTransactionThread, ...props}: PureReportActionItemProps) {
const reportID = report?.reportID ?? '';

Check failure on line 19 in src/pages/home/report/ReportActionItem.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const originalReportID = useMemo(() => ReportUtils.getOriginalReportID(reportID, action) || '-1', [reportID, action]);

Check failure on line 21 in src/pages/home/report/ReportActionItem.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

const [draftMessage] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${originalReportID}`, {
selector: (draftMessagesForReport) => {
const matchingDraftMessage = draftMessagesForReport?.[action.reportActionID];
Expand All @@ -28,21 +29,30 @@
const [emojiReactions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${action.reportActionID}`);
const [userWallet] = useOnyx(ONYXKEYS.USER_WALLET);
const [linkedTransactionRouteError] = useOnyx(
`${ONYXKEYS.COLLECTION.TRANSACTION}${ReportActionsUtils.isMoneyRequestAction(action) ? ReportActionsUtils.getOriginalMessage(action)?.IOUTransactionID ?? -1 : -1}`,

Check failure on line 32 in src/pages/home/report/ReportActionItem.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

{selector: (transaction) => transaction?.errorFields?.route ?? null},
);
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- This is needed to prevent the app from crashing when the app is using imported state.
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID || '-1'}`);

Check failure on line 36 in src/pages/home/report/ReportActionItem.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check


const [isUserValidated] = useOnyx(ONYXKEYS.USER, {selector: (user) => !!user?.validated});
// The app would crash due to subscribing to the entire report collection if parentReportID is an empty string. So we should have a fallback ID here.
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID || -1}`);

Check failure on line 41 in src/pages/home/report/ReportActionItem.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

const personalDetails = usePersonalDetails();
const blockedFromConcierge = useBlockedFromConcierge();
const [userBillingFundID] = useOnyx(ONYXKEYS.NVP_BILLING_FUND_ID);
const linkedReport = ReportUtils.isChatThread(report) ? parentReport : report;
const missingPaymentMethod = ReportUtils.getIndicatedMissingPaymentMethod(userWallet, linkedReport?.reportID ?? '-1', action);

Check failure on line 46 in src/pages/home/report/ReportActionItem.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

const policy = usePolicy(report?.policyID);
const [invoiceReceiverPolicy] = useOnyx(
`${ONYXKEYS.COLLECTION.POLICY}${report?.invoiceReceiver && 'policyID' in report.invoiceReceiver ? report.invoiceReceiver.policyID : CONST.DEFAULT_NUMBER_ID}`,
);
const IOUTransactionID = ReportActionsUtils.isMoneyRequestAction(parentReportActionForTransactionThread)
? ReportActionsUtils.getOriginalMessage(parentReportActionForTransactionThread)?.IOUTransactionID

Check failure on line 52 in src/pages/home/report/ReportActionItem.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Insert `····`

Check failure on line 52 in src/pages/home/report/ReportActionItem.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Insert `····`
: '-1';

Check failure on line 53 in src/pages/home/report/ReportActionItem.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Insert `····`

Check failure on line 53 in src/pages/home/report/ReportActionItem.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Insert `····`

Check failure on line 53 in src/pages/home/report/ReportActionItem.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check


const [IOUTransaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${IOUTransactionID ?? '-1'}`);

return (
<PureReportActionItem
Expand Down Expand Up @@ -81,6 +91,9 @@
dismissTrackExpenseActionableWhisper={Report.dismissTrackExpenseActionableWhisper}
userBillingFundID={userBillingFundID}
reportAutomaticallyForwardedMessage={ReportUtils.getReportAutomaticallyForwardedMessage(action as ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.FORWARDED>, reportID)}
policy={policy}
invoiceReceiverPolicy={invoiceReceiverPolicy}
IOUTransaction={IOUTransaction}
/>
);
}
Expand Down
24 changes: 17 additions & 7 deletions src/pages/home/report/ReportActionItemContentCreated.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import lodashIsEqual from 'lodash/isEqual';
import React, {memo, useMemo} from 'react';
import {View} from 'react-native';
import {useOnyx} from 'react-native-onyx';

Check failure on line 4 in src/pages/home/report/ReportActionItemContentCreated.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

'useOnyx' is defined but never used
import type {OnyxEntry} from 'react-native-onyx';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import RenderHTML from '@components/RenderHTML';

Check failure on line 7 in src/pages/home/report/ReportActionItemContentCreated.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Insert `{usePersonalDetails}·from·'@components/OnyxProvider';⏎import·`
import MoneyReportView from '@components/ReportActionItem/MoneyReportView';
import MoneyRequestView from '@components/ReportActionItem/MoneyRequestView';
import TaskView from '@components/ReportActionItem/TaskView';
Expand All @@ -20,12 +20,13 @@
import * as TransactionUtils from '@libs/TransactionUtils';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';

Check failure on line 23 in src/pages/home/report/ReportActionItemContentCreated.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

'ONYXKEYS' is defined but never used
import type * as OnyxTypes from '@src/types/onyx';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
import AnimatedEmptyStateBackground from './AnimatedEmptyStateBackground';
import ReportActionItemCreated from './ReportActionItemCreated';
import ReportActionItemSingle from './ReportActionItemSingle';
import { usePersonalDetails } from '@components/OnyxProvider';

Check failure on line 29 in src/pages/home/report/ReportActionItemContentCreated.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Delete `import·{·usePersonalDetails·}·from·'@components/OnyxProvider';⏎`

Check failure on line 29 in src/pages/home/report/ReportActionItemContentCreated.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

`@components/OnyxProvider` import should occur before import of `./AnimatedEmptyStateBackground`

type ReportActionItemContentCreatedProps = {
/** The context value containing the report and action data, along with the show context menu props */
Expand All @@ -37,24 +38,26 @@
/** Report action belonging to the report's parent */
parentReportAction: OnyxEntry<OnyxTypes.ReportAction>;

/** The transaction ID */
transactionID: string | undefined;
/** Transaction that stores the distance expense data */
transaction: OnyxEntry<OnyxTypes.Transaction>;

/** The draft message */
draftMessage: string | undefined;

/** Flag to show, hide the thread divider line */
shouldHideThreadDividerLine: boolean;

/** Invoice receiver policy */
invoiceReceiverPolicy: OnyxEntry<OnyxTypes.Policy>;
};

function ReportActionItemContentCreated({contextValue, parentReportAction, transactionID, draftMessage, shouldHideThreadDividerLine}: ReportActionItemContentCreatedProps) {
function ReportActionItemContentCreated({contextValue, parentReportAction, transaction, draftMessage, shouldHideThreadDividerLine, invoiceReceiverPolicy}: ReportActionItemContentCreatedProps) {

Check failure on line 54 in src/pages/home/report/ReportActionItemContentCreated.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Replace `contextValue,·parentReportAction,·transaction,·draftMessage,·shouldHideThreadDividerLine,·invoiceReceiverPolicy` with `⏎····contextValue,⏎····parentReportAction,⏎····transaction,⏎····draftMessage,⏎····shouldHideThreadDividerLine,⏎····invoiceReceiverPolicy,⏎`
const styles = useThemeStyles();
const {translate} = useLocalize();

const {report, action, transactionThreadReport} = contextValue;

const personalDetails = usePersonalDetails();
const policy = usePolicy(report.policyID === CONST.POLICY.OWNER_EMAIL_FAKE ? '-1' : report.policyID ?? '-1');
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID ?? '-1'}`);

const transactionCurrency = TransactionUtils.getCurrency(transaction);

Expand Down Expand Up @@ -96,6 +99,9 @@
action={parentReportAction}
showHeader
report={report}
policy={policy}
personalDetails={personalDetails}
invoiceReceiverPolicy={invoiceReceiverPolicy}
>
<RenderHTML html={`<comment>${translate(message)}</comment>`} />
</ReportActionItemSingle>
Expand Down Expand Up @@ -130,6 +136,9 @@
action={parentReportAction}
showHeader={draftMessage === undefined}
report={report}
policy={policy}
personalDetails={personalDetails}
invoiceReceiverPolicy={invoiceReceiverPolicy}
>
<RenderHTML html={`<comment>${translate('parentReportAction.deletedTask')}</comment>`} />
</ReportActionItemSingle>
Expand Down Expand Up @@ -200,7 +209,8 @@
(prevProps, nextProps) =>
lodashIsEqual(prevProps.contextValue, nextProps.contextValue) &&
lodashIsEqual(prevProps.parentReportAction, nextProps.parentReportAction) &&
prevProps.transactionID === nextProps.transactionID &&
lodashIsEqual(prevProps.transaction, nextProps.transaction) &&
prevProps.draftMessage === nextProps.draftMessage &&
prevProps.shouldHideThreadDividerLine === nextProps.shouldHideThreadDividerLine,
prevProps.shouldHideThreadDividerLine === nextProps.shouldHideThreadDividerLine &&
lodashIsEqual(prevProps.invoiceReceiverPolicy, nextProps.invoiceReceiverPolicy),
);
Loading
Loading