Skip to content

Commit 017630a

Browse files
authored
Merge pull request #61338 from rayane-d/fix-61295
[CP Staging] Fix: Workspace chat tooltip not displayed when invited to workspace
2 parents 45acc86 + 6c3a263 commit 017630a

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/components/LHNOptionsList/LHNOptionsList.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import BlockingView from '@components/BlockingViews/BlockingView';
99
import Icon from '@components/Icon';
1010
import * as Expensicons from '@components/Icon/Expensicons';
1111
import LottieAnimations from '@components/LottieAnimations';
12-
import {useProductTrainingContext} from '@components/ProductTrainingContext';
1312
import {ScrollOffsetContext} from '@components/ScrollOffsetContextProvider';
1413
import TextBlock from '@components/TextBlock';
1514
import useLHNEstimatedListSize from '@hooks/useLHNEstimatedListSize';
@@ -25,10 +24,12 @@ import Log from '@libs/Log';
2524
import {getIOUReportIDOfLastAction, getLastMessageTextForReport, hasReportErrors} from '@libs/OptionsListUtils';
2625
import {getOneTransactionThreadReportID, getOriginalMessage, getSortedReportActionsForDisplay, isMoneyRequestAction} from '@libs/ReportActionsUtils';
2726
import {canUserPerformWriteAction, requiresAttentionFromCurrentUser} from '@libs/ReportUtils';
27+
import isProductTrainingElementDismissed from '@libs/TooltipUtils';
2828
import variables from '@styles/variables';
2929
import CONST from '@src/CONST';
3030
import ONYXKEYS from '@src/ONYXKEYS';
3131
import type {PersonalDetails} from '@src/types/onyx';
32+
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';
3233
import OptionRowLHNData from './OptionRowLHNData';
3334
import OptionRowRendererComponent from './OptionRowRendererComponent';
3435
import type {LHNOptionsListProps, RenderItemProps} from './types';
@@ -50,6 +51,7 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio
5051
const [transactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION, {canBeMissing: false});
5152
const [draftComments] = useOnyx(ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT, {canBeMissing: false});
5253
const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, {canBeMissing: false});
54+
const [dismissedProductTraining, dismissedProductTrainingMetadata] = useOnyx(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, {canBeMissing: true});
5355

5456
const theme = useTheme();
5557
const styles = useThemeStyles();
@@ -59,10 +61,11 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio
5961
const estimatedItemSize = optionMode === CONST.OPTION_MODE.COMPACT ? variables.optionRowHeightCompact : variables.optionRowHeight;
6062
const platform = getPlatform();
6163
const isWebOrDesktop = platform === CONST.PLATFORM.WEB || platform === CONST.PLATFORM.DESKTOP;
64+
const isGBRorRBRTooltipDismissed =
65+
!isLoadingOnyxValue(dismissedProductTrainingMetadata) && isProductTrainingElementDismissed(CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GBR_RBR_CHAT, dismissedProductTraining);
6266

63-
const {shouldShowProductTrainingTooltip} = useProductTrainingContext(CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GBR_RBR_CHAT, true);
6467
const firstReportIDWithGBRorRBR = useMemo(() => {
65-
if (!shouldShowProductTrainingTooltip) {
68+
if (isGBRorRBRTooltipDismissed) {
6669
return undefined;
6770
}
6871
return data.find((reportID) => {
@@ -79,7 +82,7 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio
7982
const hasGBR = requiresAttentionFromCurrentUser(itemFullReport, itemParentReportAction);
8083
return hasGBR;
8184
});
82-
}, [shouldShowProductTrainingTooltip, data, reportActions, reports]);
85+
}, [isGBRorRBRTooltipDismissed, data, reportActions, reports]);
8386

8487
// When the first item renders we want to call the onFirstItemRendered callback.
8588
// At this point in time we know that the list is actually displaying items.

src/components/LHNOptionsList/OptionRowLHN.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,19 @@ function OptionRowLHN({
8181
const isReportsSplitNavigatorLast = useRootNavigationState((state) => state?.routes?.at(-1)?.name === NAVIGATORS.REPORTS_SPLIT_NAVIGATOR);
8282

8383
const {tooltipToRender, shouldShowTooltip, shouldTooltipBeLeftAligned} = useMemo(() => {
84-
// TODO: CONCIERGE_LHN_GBR tooltip will be replaced by a tooltip in the #admins room
85-
// https://github.com/Expensify/App/issues/57045#issuecomment-2701455668
86-
let tooltip: ProductTrainingTooltipName = shouldShowGetStartedTooltip
87-
? CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.CONCIERGE_LHN_GBR
88-
: CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.LHN_WORKSPACE_CHAT_TOOLTIP;
84+
let tooltip: ProductTrainingTooltipName;
8985
if (shouldShowRBRorGBRTooltip) {
9086
tooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GBR_RBR_CHAT;
87+
} else if (shouldShowWorkspaceChatTooltip) {
88+
tooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.LHN_WORKSPACE_CHAT_TOOLTIP;
89+
} else {
90+
// TODO: CONCIERGE_LHN_GBR tooltip will be replaced by a tooltip in the #admins room
91+
// https://github.com/Expensify/App/issues/57045#issuecomment-2701455668
92+
tooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.CONCIERGE_LHN_GBR;
9193
}
9294
const shouldShowTooltips = shouldShowRBRorGBRTooltip || shouldShowWorkspaceChatTooltip || shouldShowGetStartedTooltip;
9395
const shouldTooltipBeVisible = shouldUseNarrowLayout ? isScreenFocused && isReportsSplitNavigatorLast : isReportsSplitNavigatorLast && !isFullscreenVisible;
9496

95-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
9697
return {
9798
tooltipToRender: tooltip,
9899
shouldShowTooltip: shouldShowTooltips && shouldTooltipBeVisible,

0 commit comments

Comments
 (0)