From 5c22353e3dd2b9a2a6a177bd753e2a73fc9e74f2 Mon Sep 17 00:00:00 2001 From: cretadn22 Date: Sat, 30 May 2026 15:31:08 +0700 Subject: [PATCH] refactor: update isConciergeChatReport usage across multiple components --- .../OptionRowLHN/OptionRow/ProductTrainingTooltip.tsx | 2 +- src/hooks/useBankAccountUnlockEffect.ts | 2 +- src/pages/DynamicReportDetailsPage.tsx | 2 +- src/pages/ProfilePage.tsx | 3 ++- src/pages/inbox/AccountManagerBanner.tsx | 3 ++- src/pages/inbox/HeaderView.tsx | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/LHNOptionsList/OptionRowLHN/OptionRow/ProductTrainingTooltip.tsx b/src/components/LHNOptionsList/OptionRowLHN/OptionRow/ProductTrainingTooltip.tsx index 63484349684d..eb1ffc49ce57 100644 --- a/src/components/LHNOptionsList/OptionRowLHN/OptionRow/ProductTrainingTooltip.tsx +++ b/src/components/LHNOptionsList/OptionRowLHN/OptionRow/ProductTrainingTooltip.tsx @@ -58,7 +58,7 @@ function ProductTrainingTooltip({optionItem, children}: ProductTrainingTooltipPr const shouldShowRBRorGBRTooltip = firstReportIDWithGBRorRBR === optionItem.reportID; const isOnboardingGuideAssigned = onboardingPurpose === CONST.ONBOARDING_CHOICES.MANAGE_TEAM && !session?.email?.includes('+'); const isChatUsedForOnboarding = isChatUsedForOnboardingReportUtils(optionItem, onboarding, conciergeReportID, onboardingPurpose); - const shouldShowGetStartedTooltip = isOnboardingGuideAssigned ? isAdminRoom(optionItem) && isChatUsedForOnboarding : isConciergeChatReport(optionItem); + const shouldShowGetStartedTooltip = isOnboardingGuideAssigned ? isAdminRoom(optionItem) && isChatUsedForOnboarding : isConciergeChatReport(optionItem, conciergeReportID); // Skip the inner component (and its heavy hooks) entirely when the row can never show a tooltip. const shouldEvaluateTooltip = shouldShowRBRorGBRTooltip || shouldShowGetStartedTooltip; diff --git a/src/hooks/useBankAccountUnlockEffect.ts b/src/hooks/useBankAccountUnlockEffect.ts index 44d21c522121..deda44c90b84 100644 --- a/src/hooks/useBankAccountUnlockEffect.ts +++ b/src/hooks/useBankAccountUnlockEffect.ts @@ -11,7 +11,7 @@ function useBankAccountUnlockEffect(report: OnyxEntry | undefined) { const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); useEffect(() => { - if (!isConciergeChatReport(report) || !initiatingBankAccountUnlock?.bankAccountIDToUnlock) { + if (!isConciergeChatReport(report, conciergeReportID) || !initiatingBankAccountUnlock?.bankAccountIDToUnlock) { return; } initiateBankAccountUnlock(initiatingBankAccountUnlock.bankAccountIDToUnlock, conciergeReportID ?? undefined, initiatingBankAccountUnlock.optimisticReportActionID); diff --git a/src/pages/DynamicReportDetailsPage.tsx b/src/pages/DynamicReportDetailsPage.tsx index 794758a1b07c..23da288a1e7f 100644 --- a/src/pages/DynamicReportDetailsPage.tsx +++ b/src/pages/DynamicReportDetailsPage.tsx @@ -419,7 +419,7 @@ function DynamicReportDetailsPage({policy, report, route, reportMetadata, report (isDefaultRoom && isChatThread && isPolicyEmployee) || (!isUserCreatedPolicyRoom && participants.length) || (isUserCreatedPolicyRoom && (isPolicyEmployee || (isChatThread && !isPublicRoomUtil(report))))) && - !isConciergeChatReport(report) && + !isConciergeChatReport(report, conciergeReportID) && !isSystemChat && activeChatMembers.length > 0 ) { diff --git a/src/pages/ProfilePage.tsx b/src/pages/ProfilePage.tsx index 59e6df9acd4e..b79a7d721341 100755 --- a/src/pages/ProfilePage.tsx +++ b/src/pages/ProfilePage.tsx @@ -94,6 +94,7 @@ function ProfilePage({route}: ProfilePageProps) { const reportKey = isAnonymousUserSession() || !reportID ? (`${ONYXKEYS.COLLECTION.REPORT}0` as const) : (`${ONYXKEYS.COLLECTION.REPORT}${reportID}` as const); const [report] = useOnyx(reportKey); + const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); const backPath = useDynamicBackPath(DYNAMIC_ROUTES.PROFILE.path); const styles = useThemeStyles(); @@ -158,7 +159,7 @@ function ProfilePage({route}: ProfilePageProps) { const notificationPreference = shouldShowNotificationPreference ? translate(`notificationPreferencesPage.notificationPreferences.${notificationPreferenceValue}` as TranslationPaths) : ''; - const isConcierge = isConciergeChatReport(report); + const isConcierge = isConciergeChatReport(report, conciergeReportID); // eslint-disable-next-line rulesdir/prefer-early-return useEffect(() => { diff --git a/src/pages/inbox/AccountManagerBanner.tsx b/src/pages/inbox/AccountManagerBanner.tsx index f4055b2c2449..32ab98ba2532 100644 --- a/src/pages/inbox/AccountManagerBanner.tsx +++ b/src/pages/inbox/AccountManagerBanner.tsx @@ -22,6 +22,7 @@ function AccountManagerBanner({reportID}: AccountManagerBannerProps) { const {translate} = useLocalize(); const expensifyIcons = useMemoizedLazyExpensifyIcons(['Lightbulb']); const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(reportID)}`); + const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); const [accountManagerData] = useOnyx(ONYXKEYS.ACCOUNT, { selector: (account) => ({ accountManagerReportID: account?.accountManagerReportID, @@ -35,7 +36,7 @@ function AccountManagerBanner({reportID}: AccountManagerBannerProps) { }); const [isBannerVisible, setIsBannerVisible] = useState(true); - if (!accountManagerReportID || !isConciergeChatReport(report) || !isBannerVisible) { + if (!accountManagerReportID || !isConciergeChatReport(report, conciergeReportID) || !isBannerVisible) { return null; } const displayName = getDisplayNameOrDefault(participantPersonalDetail); diff --git a/src/pages/inbox/HeaderView.tsx b/src/pages/inbox/HeaderView.tsx index 04a2c94d78ae..8c8100f21c8b 100644 --- a/src/pages/inbox/HeaderView.tsx +++ b/src/pages/inbox/HeaderView.tsx @@ -251,7 +251,7 @@ function HeaderView({onNavigationMenuButtonClicked, reportID}: HeaderViewProps) const shouldShowEarlyDiscountBanner = shouldShowDiscount && isChatUsedForOnboarding && !isInSidePanel; const latestScheduledCall = reportNameValuePairs?.calendlyCalls?.at(-1); const hasActiveScheduledCall = latestScheduledCall && !isPast(latestScheduledCall.eventTime) && latestScheduledCall.status !== CONST.SCHEDULE_CALL_STATUS.CANCELLED; - const shouldShowCloseButton = !!isInSidePanel && !shouldUseNarrowLayout && isConciergeChatReport(report); + const shouldShowCloseButton = !!isInSidePanel && !shouldUseNarrowLayout && isConciergeChatReport(report, conciergeReportID); const shouldShowBackButton = (shouldUseNarrowLayout || !!isInSidePanel) && !shouldShowCloseButton; const onboardingHelpDropdownButton = (