@@ -12,6 +12,7 @@ import OfflineWithFeedback from '@components/OfflineWithFeedback';
1212import { useSession } from '@components/OnyxProvider' ;
1313import PressableWithSecondaryInteraction from '@components/PressableWithSecondaryInteraction' ;
1414import { useProductTrainingContext } from '@components/ProductTrainingContext' ;
15+ import type { ProductTrainingTooltipName } from '@components/ProductTrainingContext/TOOLTIPS' ;
1516import SubscriptAvatar from '@components/SubscriptAvatar' ;
1617import Text from '@components/Text' ;
1718import Tooltip from '@components/Tooltip' ;
@@ -49,18 +50,28 @@ import ONYXKEYS from '@src/ONYXKEYS';
4950import { isEmptyObject } from '@src/types/utils/EmptyObject' ;
5051import type { OptionRowLHNProps } from './types' ;
5152
52- function OptionRowLHN ( { reportID, isFocused = false , onSelectRow = ( ) => { } , optionItem, viewMode = 'default' , style, onLayout = ( ) => { } , hasDraftComment} : OptionRowLHNProps ) {
53+ function OptionRowLHN ( {
54+ reportID,
55+ isFocused = false ,
56+ onSelectRow = ( ) => { } ,
57+ optionItem,
58+ viewMode = 'default' ,
59+ style,
60+ onLayout = ( ) => { } ,
61+ hasDraftComment,
62+ shouldShowRBRorGBRTooltip,
63+ } : OptionRowLHNProps ) {
5364 const theme = useTheme ( ) ;
5465 const styles = useThemeStyles ( ) ;
5566 const popoverAnchor = useRef < View > ( null ) ;
5667 const StyleUtils = useStyleUtils ( ) ;
5768 const [ isScreenFocused , setIsScreenFocused ] = useState ( false ) ;
5869 const { shouldUseNarrowLayout} = useResponsiveLayout ( ) ;
5970
60- const [ report ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ optionItem ?. reportID } ` ) ;
61- const [ activePolicyID ] = useOnyx ( ONYXKEYS . NVP_ACTIVE_POLICY_ID ) ;
62- const [ introSelected ] = useOnyx ( ONYXKEYS . NVP_INTRO_SELECTED ) ;
63- const [ isFullscreenVisible ] = useOnyx ( ONYXKEYS . FULLSCREEN_VISIBILITY ) ;
71+ const [ report ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ optionItem ?. reportID } ` , { canBeMissing : true } ) ;
72+ const [ activePolicyID ] = useOnyx ( ONYXKEYS . NVP_ACTIVE_POLICY_ID , { canBeMissing : true } ) ;
73+ const [ introSelected ] = useOnyx ( ONYXKEYS . NVP_INTRO_SELECTED , { canBeMissing : true } ) ;
74+ const [ isFullscreenVisible ] = useOnyx ( ONYXKEYS . FULLSCREEN_VISIBILITY , { canBeMissing : true } ) ;
6475 const session = useSession ( ) ;
6576 const shouldShowWorkspaceChatTooltip = isPolicyExpenseChat ( report ) && ! isThread ( report ) && activePolicyID === report ?. policyID && session ?. accountID === report ?. ownerAccountID ;
6677 const isOnboardingGuideAssigned = introSelected ?. choice === CONST . ONBOARDING_CHOICES . MANAGE_TEAM && ! session ?. email ?. includes ( '+' ) ;
@@ -69,16 +80,25 @@ function OptionRowLHN({reportID, isFocused = false, onSelectRow = () => {}, opti
6980
7081 const isReportsSplitNavigatorLast = useRootNavigationState ( ( state ) => state ?. routes ?. at ( - 1 ) ?. name === NAVIGATORS . REPORTS_SPLIT_NAVIGATOR ) ;
7182
72- const { tooltipToRender, shouldShowTooltip} = useMemo ( ( ) => {
83+ const { tooltipToRender, shouldShowTooltip, shouldTooltipBeLeftAligned } = useMemo ( ( ) => {
7384 // TODO: CONCIERGE_LHN_GBR tooltip will be replaced by a tooltip in the #admins room
7485 // https://github.com/Expensify/App/issues/57045#issuecomment-2701455668
75- const tooltip = shouldShowGetStartedTooltip ? CONST . PRODUCT_TRAINING_TOOLTIP_NAMES . CONCIERGE_LHN_GBR : CONST . PRODUCT_TRAINING_TOOLTIP_NAMES . LHN_WORKSPACE_CHAT_TOOLTIP ;
76- const shouldShowTooltips = shouldShowWorkspaceChatTooltip || shouldShowGetStartedTooltip ;
86+ let tooltip : ProductTrainingTooltipName = shouldShowGetStartedTooltip
87+ ? CONST . PRODUCT_TRAINING_TOOLTIP_NAMES . CONCIERGE_LHN_GBR
88+ : CONST . PRODUCT_TRAINING_TOOLTIP_NAMES . LHN_WORKSPACE_CHAT_TOOLTIP ;
89+ if ( shouldShowRBRorGBRTooltip ) {
90+ tooltip = CONST . PRODUCT_TRAINING_TOOLTIP_NAMES . GBR_RBR_CHAT ;
91+ }
92+ const shouldShowTooltips = shouldShowRBRorGBRTooltip || shouldShowWorkspaceChatTooltip || shouldShowGetStartedTooltip ;
7793 const shouldTooltipBeVisible = shouldUseNarrowLayout ? isScreenFocused && isReportsSplitNavigatorLast : isReportsSplitNavigatorLast && ! isFullscreenVisible ;
7894
7995 // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
80- return { tooltipToRender : tooltip , shouldShowTooltip : shouldShowTooltips && shouldTooltipBeVisible } ;
81- } , [ shouldShowGetStartedTooltip , shouldShowWorkspaceChatTooltip , isScreenFocused , shouldUseNarrowLayout , isReportsSplitNavigatorLast , isFullscreenVisible ] ) ;
96+ return {
97+ tooltipToRender : tooltip ,
98+ shouldShowTooltip : shouldShowTooltips && shouldTooltipBeVisible ,
99+ shouldTooltipBeLeftAligned : shouldShowWorkspaceChatTooltip && ! shouldShowRBRorGBRTooltip && ! shouldShowGetStartedTooltip ,
100+ } ;
101+ } , [ shouldShowRBRorGBRTooltip , shouldShowGetStartedTooltip , shouldShowWorkspaceChatTooltip , isScreenFocused , shouldUseNarrowLayout , isReportsSplitNavigatorLast , isFullscreenVisible ] ) ;
82102
83103 const { shouldShowProductTrainingTooltip, renderProductTrainingTooltip, hideProductTrainingTooltip} = useProductTrainingContext ( tooltipToRender , shouldShowTooltip ) ;
84104
@@ -195,11 +215,11 @@ function OptionRowLHN({reportID, isFocused = false, onSelectRow = () => {}, opti
195215 shouldRender = { shouldShowProductTrainingTooltip }
196216 renderTooltipContent = { renderProductTrainingTooltip }
197217 anchorAlignment = { {
198- horizontal : shouldShowWorkspaceChatTooltip ? CONST . MODAL . ANCHOR_ORIGIN_HORIZONTAL . LEFT : CONST . MODAL . ANCHOR_ORIGIN_HORIZONTAL . RIGHT ,
218+ horizontal : shouldTooltipBeLeftAligned ? CONST . MODAL . ANCHOR_ORIGIN_HORIZONTAL . LEFT : CONST . MODAL . ANCHOR_ORIGIN_HORIZONTAL . RIGHT ,
199219 vertical : CONST . MODAL . ANCHOR_ORIGIN_VERTICAL . TOP ,
200220 } }
201- shiftHorizontal = { shouldShowWorkspaceChatTooltip ? variables . workspaceLHNTooltipShiftHorizontal : variables . gbrTooltipShiftHorizontal }
202- shiftVertical = { shouldShowWorkspaceChatTooltip ? 0 : variables . gbrTooltipShiftVertical }
221+ shiftHorizontal = { shouldTooltipBeLeftAligned ? variables . workspaceLHNTooltipShiftHorizontal : variables . gbrTooltipShiftHorizontal }
222+ shiftVertical = { shouldTooltipBeLeftAligned ? 0 : variables . gbrTooltipShiftVertical }
203223 wrapperStyle = { styles . productTrainingTooltipWrapper }
204224 onTooltipPress = { onOptionPress }
205225 shouldHideOnScroll
0 commit comments