From 9f10acc1f36ce44a96a26be786c9873e33f1e808 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Mon, 17 Mar 2025 02:12:52 +0100 Subject: [PATCH 01/26] Add RBR/GBR chat and Account switcher tooltips --- src/CONST.ts | 2 + src/components/AccountSwitcher.tsx | 143 ++++++++++-------- .../LHNOptionsList/LHNOptionsList.tsx | 30 +++- .../LHNOptionsList/OptionRowLHN.tsx | 24 ++- src/components/LHNOptionsList/types.ts | 6 + .../ProductTrainingContext/TOOLTIPS.ts | 27 +++- src/languages/en.ts | 11 ++ src/languages/es.ts | 11 ++ src/styles/variables.ts | 2 + src/types/onyx/DismissedProductTraining.ts | 12 ++ 10 files changed, 201 insertions(+), 67 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index cfccbfd12ff1d..4a86029666bcb 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -6817,6 +6817,8 @@ const CONST = { SCAN_TEST_TOOLTIP: 'scanTestTooltip', SCAN_TEST_TOOLTIP_MANAGER: 'scanTestTooltipManager', SCAN_TEST_CONFIRMATION: 'scanTestConfirmation', + GBR_RBR_CHAT: 'chatGBRRBR', + ACCOUNT_SWITCHER: 'accountSwitcher', }, CHANGE_POLICY_TRAINING_MODAL: 'changePolicyModal', SMART_BANNER_HEIGHT: 152, diff --git a/src/components/AccountSwitcher.tsx b/src/components/AccountSwitcher.tsx index ed2eae7a0a4c6..ea4eec2290562 100644 --- a/src/components/AccountSwitcher.tsx +++ b/src/components/AccountSwitcher.tsx @@ -10,11 +10,11 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import {clearDelegatorErrors, connect, disconnect} from '@libs/actions/Delegate'; -import * as EmojiUtils from '@libs/EmojiUtils'; -import * as ErrorUtils from '@libs/ErrorUtils'; -import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; +import {getProcessedText, splitTextWithEmojis} from '@libs/EmojiUtils'; +import {getLatestError} from '@libs/ErrorUtils'; +import {getPersonalDetailByEmail} from '@libs/PersonalDetailsUtils'; import variables from '@styles/variables'; -import * as Modal from '@userActions/Modal'; +import {close} from '@userActions/Modal'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {PersonalDetails} from '@src/types/onyx'; @@ -26,7 +26,9 @@ import * as Expensicons from './Icon/Expensicons'; import type {PopoverMenuItem} from './PopoverMenu'; import PopoverMenu from './PopoverMenu'; import {PressableWithFeedback} from './Pressable'; +import {useProductTrainingContext} from './ProductTrainingContext'; import Text from './Text'; +import EducationalTooltip from './Tooltip/EducationalTooltip'; function AccountSwitcher() { const currentUserPersonalDetails = useCurrentUserPersonalDetails(); @@ -47,7 +49,12 @@ function AccountSwitcher() { const isActingAsDelegate = !!account?.delegatedAccess?.delegate ?? false; const canSwitchAccounts = delegators.length > 0 || isActingAsDelegate; - const processedTextArray = EmojiUtils.splitTextWithEmojis(currentUserPersonalDetails?.displayName); + const processedTextArray = splitTextWithEmojis(currentUserPersonalDetails?.displayName); + + const {shouldShowProductTrainingTooltip, renderProductTrainingTooltip, hideProductTrainingTooltip} = useProductTrainingContext( + CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.ACCOUNT_SWITCHER, + canSwitchAccounts, + ); const createBaseMenuItem = ( personalDetails: PersonalDetails | undefined, @@ -58,7 +65,7 @@ function AccountSwitcher() { return { text: personalDetails?.displayName ?? personalDetails?.login ?? '', description: Str.removeSMSDomain(personalDetails?.login ?? ''), - avatarID: personalDetails?.accountID ?? -1, + avatarID: personalDetails?.accountID ?? CONST.DEFAULT_NUMBER_ID, icon: personalDetails?.avatar ?? '', iconType: CONST.ICON_TYPE_AVATAR, outerWrapperStyle: shouldUseNarrowLayout ? {} : styles.accountSwitcherPopover, @@ -86,14 +93,14 @@ function AccountSwitcher() { return [currentUserMenuItem]; } - const delegatePersonalDetails = PersonalDetailsUtils.getPersonalDetailByEmail(delegateEmail); - const error = ErrorUtils.getLatestError(account?.delegatedAccess?.errorFields?.disconnect); + const delegatePersonalDetails = getPersonalDetailByEmail(delegateEmail); + const error = getLatestError(account?.delegatedAccess?.errorFields?.disconnect); return [ createBaseMenuItem(delegatePersonalDetails, error, { onSelected: () => { if (isOffline) { - Modal.close(() => setShouldShowOfflineModal(true)); + close(() => setShouldShowOfflineModal(true)); return; } disconnect(); @@ -107,13 +114,13 @@ function AccountSwitcher() { .filter(({email}) => email !== currentUserPersonalDetails.login) .map(({email, role}) => { const errorFields = account?.delegatedAccess?.errorFields ?? {}; - const error = ErrorUtils.getLatestError(errorFields?.connect?.[email]); - const personalDetails = PersonalDetailsUtils.getPersonalDetailByEmail(email); + const error = getLatestError(errorFields?.connect?.[email]); + const personalDetails = getPersonalDetailByEmail(email); return createBaseMenuItem(personalDetails, error, { badgeText: translate('delegate.role', {role}), onSelected: () => { if (isOffline) { - Modal.close(() => setShouldShowOfflineModal(true)); + close(() => setShouldShowOfflineModal(true)); return; } connect(email); @@ -124,65 +131,81 @@ function AccountSwitcher() { return [currentUserMenuItem, ...delegatorMenuItems]; }; + const onPressSwitcher = () => { + hideProductTrainingTooltip(); + setShouldShowDelegatorMenu(!shouldShowDelegatorMenu); + }; + return ( <> - { - setShouldShowDelegatorMenu(!shouldShowDelegatorMenu); + - - - - + + + + + + + {processedTextArray.length !== 0 ? getProcessedText(processedTextArray, styles.initialSettingsUsernameEmoji) : currentUserPersonalDetails?.displayName} + + {!!canSwitchAccounts && ( + + + + )} + - {processedTextArray.length !== 0 - ? EmojiUtils.getProcessedText(processedTextArray, styles.initialSettingsUsernameEmoji) - : currentUserPersonalDetails?.displayName} + {Str.removeSMSDomain(currentUserPersonalDetails?.login ?? '')} - {!!canSwitchAccounts && ( - - - + {!!user?.isDebugModeEnabled && ( + + AccountID: {session?.accountID} + )} - - {Str.removeSMSDomain(currentUserPersonalDetails?.login ?? '')} - - {!!user?.isDebugModeEnabled && ( - - AccountID: {session?.accountID} - - )} - - + + + {!!canSwitchAccounts && ( { + if (!shouldShowProductTrainingTooltip) { + return undefined; + } + return data.find((reportID) => { + const itemFullReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; + const itemReportActions = reportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`]; + if (!itemFullReport) { + return false; + } + if (hasReportErrors(itemFullReport, itemReportActions)) { + return true; + } + const itemParentReportActions = reportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${itemFullReport?.parentReportID}`]; + const itemParentReportAction = itemFullReport?.parentReportActionID ? itemParentReportActions?.[itemFullReport?.parentReportActionID] : undefined; + const hasGBR = requiresAttentionFromCurrentUser(itemFullReport, itemParentReportAction); + return hasGBR; + }); + }, [shouldShowProductTrainingTooltip, data, reportActions, reports]); + // When the first item renders we want to call the onFirstItemRendered callback. // At this point in time we know that the list is actually displaying items. const hasCalledOnLayout = React.useRef(false); @@ -179,6 +201,8 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio } const lastMessageTextFromReport = getLastMessageTextForReport(itemFullReport, lastActorDetails, itemPolicy); + const shouldShowRBRorGPRTooltip = firstReportIDWithGBRorRGR === reportID; + return ( ); }, @@ -220,6 +245,7 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio transactionViolations, onLayoutItem, isOffline, + firstReportIDWithGBRorRGR, ], ); diff --git a/src/components/LHNOptionsList/OptionRowLHN.tsx b/src/components/LHNOptionsList/OptionRowLHN.tsx index a4e0164e388b1..0bea845ffd52c 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.tsx +++ b/src/components/LHNOptionsList/OptionRowLHN.tsx @@ -12,6 +12,7 @@ import OfflineWithFeedback from '@components/OfflineWithFeedback'; import {useSession} from '@components/OnyxProvider'; import PressableWithSecondaryInteraction from '@components/PressableWithSecondaryInteraction'; import {useProductTrainingContext} from '@components/ProductTrainingContext'; +import type {ProductTrainingTooltipName} from '@components/ProductTrainingContext/TOOLTIPS'; import SubscriptAvatar from '@components/SubscriptAvatar'; import Text from '@components/Text'; import Tooltip from '@components/Tooltip'; @@ -49,7 +50,17 @@ import ONYXKEYS from '@src/ONYXKEYS'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import type {OptionRowLHNProps} from './types'; -function OptionRowLHN({reportID, isFocused = false, onSelectRow = () => {}, optionItem, viewMode = 'default', style, onLayout = () => {}, hasDraftComment}: OptionRowLHNProps) { +function OptionRowLHN({ + reportID, + isFocused = false, + onSelectRow = () => {}, + optionItem, + viewMode = 'default', + style, + onLayout = () => {}, + hasDraftComment, + shouldShowRBRorGPRTooltip, +}: OptionRowLHNProps) { const theme = useTheme(); const styles = useThemeStyles(); const popoverAnchor = useRef(null); @@ -70,13 +81,18 @@ function OptionRowLHN({reportID, isFocused = false, onSelectRow = () => {}, opti const isReportsSplitNavigatorLast = useRootNavigationState((state) => state?.routes?.at(-1)?.name === NAVIGATORS.REPORTS_SPLIT_NAVIGATOR); const {tooltipToRender, shouldShowTooltip} = useMemo(() => { - const tooltip = shouldShowGetStartedTooltip ? CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.CONCEIRGE_LHN_GBR : CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.LHN_WORKSPACE_CHAT_TOOLTIP; - const shouldShowTooltips = shouldShowWokspaceChatTooltip || shouldShowGetStartedTooltip; + // TODO: CONCEIRGE_LHN_GBR tooltip will be replaced by a tooltip in the #admins room + // https://github.com/Expensify/App/issues/57045#issuecomment-2701455668 + let tooltip: ProductTrainingTooltipName = shouldShowGetStartedTooltip ? CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.CONCEIRGE_LHN_GBR : CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.LHN_WORKSPACE_CHAT_TOOLTIP; + if (shouldShowRBRorGPRTooltip) { + tooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GBR_RBR_CHAT; + } + const shouldShowTooltips = shouldShowRBRorGPRTooltip || shouldShowWokspaceChatTooltip || shouldShowGetStartedTooltip; const shouldTooltipBeVisible = shouldUseNarrowLayout ? isScreenFocused && isReportsSplitNavigatorLast : isReportsSplitNavigatorLast && !isFullscreenVisible; // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing return {tooltipToRender: tooltip, shouldShowTooltip: shouldShowTooltips && shouldTooltipBeVisible}; - }, [shouldShowGetStartedTooltip, shouldShowWokspaceChatTooltip, isScreenFocused, shouldUseNarrowLayout, isReportsSplitNavigatorLast, isFullscreenVisible]); + }, [shouldShowRBRorGPRTooltip, shouldShowGetStartedTooltip, shouldShowWokspaceChatTooltip, isScreenFocused, shouldUseNarrowLayout, isReportsSplitNavigatorLast, isFullscreenVisible]); const {shouldShowProductTrainingTooltip, renderProductTrainingTooltip, hideProductTrainingTooltip} = useProductTrainingContext(tooltipToRender, shouldShowTooltip); diff --git a/src/components/LHNOptionsList/types.ts b/src/components/LHNOptionsList/types.ts index 597523dd522a9..e631b537e1349 100644 --- a/src/components/LHNOptionsList/types.ts +++ b/src/components/LHNOptionsList/types.ts @@ -102,6 +102,9 @@ type OptionRowLHNDataProps = { /** Callback to execute when the OptionList lays out */ onLayout?: (event: LayoutChangeEvent) => void; + + /** Whether to show the educational tooltip for the GBR or RBR */ + shouldShowRBRorGPRTooltip: boolean; }; type OptionRowLHNProps = { @@ -127,6 +130,9 @@ type OptionRowLHNProps = { hasDraftComment: boolean; onLayout?: (event: LayoutChangeEvent) => void; + + /** Whether to show the educational tooltip on the GBR or RBR */ + shouldShowRBRorGPRTooltip: boolean; }; type RenderItemProps = {item: string}; diff --git a/src/components/ProductTrainingContext/TOOLTIPS.ts b/src/components/ProductTrainingContext/TOOLTIPS.ts index 90e91166fba76..9578d4c13c0db 100644 --- a/src/components/ProductTrainingContext/TOOLTIPS.ts +++ b/src/components/ProductTrainingContext/TOOLTIPS.ts @@ -15,6 +15,8 @@ const { SCAN_TEST_TOOLTIP, SCAN_TEST_TOOLTIP_MANAGER, SCAN_TEST_CONFIRMATION, + GBR_RBR_CHAT, + ACCOUNT_SWITCHER, } = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES; type ProductTrainingTooltipName = ValueOf; @@ -114,7 +116,30 @@ const TOOLTIPS: Record = { ], onHideTooltip: () => dismissProductTraining(LHN_WORKSPACE_CHAT_TOOLTIP), name: LHN_WORKSPACE_CHAT_TOOLTIP, - priority: 800, + priority: 1800, + shouldShow: () => true, + }, + [GBR_RBR_CHAT]: { + content: [ + {text: 'productTrainingTooltip.GBRRBRChat.part1', isBold: false}, + {text: 'productTrainingTooltip.GBRRBRChat.part2', isBold: true}, + {text: 'productTrainingTooltip.GBRRBRChat.part3', isBold: false}, + {text: 'productTrainingTooltip.GBRRBRChat.part4', isBold: true}, + ], + onHideTooltip: () => dismissProductTraining(GBR_RBR_CHAT), + name: GBR_RBR_CHAT, + priority: 1900, + shouldShow: () => true, + }, + [ACCOUNT_SWITCHER]: { + content: [ + {text: 'productTrainingTooltip.accountSwitcher.part1', isBold: false}, + {text: 'productTrainingTooltip.accountSwitcher.part2', isBold: true}, + {text: 'productTrainingTooltip.accountSwitcher.part3', isBold: false}, + ], + onHideTooltip: () => dismissProductTraining(ACCOUNT_SWITCHER), + name: ACCOUNT_SWITCHER, + priority: 1600, shouldShow: () => true, }, [SCAN_TEST_TOOLTIP]: { diff --git a/src/languages/en.ts b/src/languages/en.ts index 5f44cde8afb56..5006e5266ef17 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -5978,6 +5978,17 @@ const translations = { part2: ', start chatting,', part3: '\nand more!', }, + GBRRBRChat: { + part1: 'You’ll see 🟢 on ', + part2: 'actions to take', + part3: ',\nand 🔴 on ', + part4: 'errors to review.', + }, + accountSwitcher: { + part1: 'Access your ', + part2: 'Copilot accounts', + part3: ' here', + }, scanTestTooltip: { part1: 'Want to see how Scan works?', part2: ' Try a test \nreceipt!', diff --git a/src/languages/es.ts b/src/languages/es.ts index 33b62a5eb8d46..c046205cd5875 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -6500,6 +6500,17 @@ const translations = { part2: ', comienza a chatear,', part3: '\ny mucho más!', }, + GBRRBRChat: { + part1: 'Verás 🟢 en ', + part2: 'acciones a realizar', + part3: ',\ny 🔴 en ', + part4: 'errores para revisar.', + }, + accountSwitcher: { + part1: 'Accede a tus ', + part2: 'cuentas Copilot', + part3: ' aquí', + }, scanTestTooltip: { part1: '¿Quieres ver cómo funciona Escanear?', part2: ' \n¡Prueba con un recibo de prueba!', diff --git a/src/styles/variables.ts b/src/styles/variables.ts index 2b39f2320b91f..e2d064de1bbf3 100644 --- a/src/styles/variables.ts +++ b/src/styles/variables.ts @@ -275,6 +275,8 @@ export default { searchFiltersTooltipShiftHorizontalNarrow: -10, searchFiltersTooltipShiftVerticalNarrow: 5, bottomTabInboxTooltipShiftHorizontal: 36, + accountSwitcherTooltipShiftVertical: 7, + accountSwitcherTooltipShiftHorizontal: 4, inlineImagePreviewMinSize: 64, inlineImagePreviewMaxSize: 148, diff --git a/src/types/onyx/DismissedProductTraining.ts b/src/types/onyx/DismissedProductTraining.ts index 283c660be2e11..981a409880f0f 100644 --- a/src/types/onyx/DismissedProductTraining.ts +++ b/src/types/onyx/DismissedProductTraining.ts @@ -12,6 +12,8 @@ const { SCAN_TEST_TOOLTIP, SCAN_TEST_TOOLTIP_MANAGER, SCAN_TEST_CONFIRMATION, + ACCOUNT_SWITCHER, + GBR_RBR_CHAT, } = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES; /** * This type is used to store the timestamp of when the user dismisses a product training ui elements. @@ -77,6 +79,16 @@ type DismissedProductTraining = { */ [SCAN_TEST_CONFIRMATION]: string; + /** + * When user dismisses the accountSwitcher product training tooltip, we store the timestamp here. + */ + [ACCOUNT_SWITCHER]: string; + + /** + * When user dismisses the gbrRbrChat product training tooltip, we store the timestamp here. + */ + [GBR_RBR_CHAT]: string; + /** * When user dismisses the ChangeReportPolicy feature training modal, we store the timestamp here. */ From ebe2e566659336f1bbaf2bcbb74f6c732b838cfc Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Mon, 17 Mar 2025 02:21:22 +0100 Subject: [PATCH 02/26] prettier --- src/components/LHNOptionsList/OptionRowLHN.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/LHNOptionsList/OptionRowLHN.tsx b/src/components/LHNOptionsList/OptionRowLHN.tsx index 0bea845ffd52c..1d7c75a7cd803 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.tsx +++ b/src/components/LHNOptionsList/OptionRowLHN.tsx @@ -83,7 +83,9 @@ function OptionRowLHN({ const {tooltipToRender, shouldShowTooltip} = useMemo(() => { // TODO: CONCEIRGE_LHN_GBR tooltip will be replaced by a tooltip in the #admins room // https://github.com/Expensify/App/issues/57045#issuecomment-2701455668 - let tooltip: ProductTrainingTooltipName = shouldShowGetStartedTooltip ? CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.CONCEIRGE_LHN_GBR : CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.LHN_WORKSPACE_CHAT_TOOLTIP; + let tooltip: ProductTrainingTooltipName = shouldShowGetStartedTooltip + ? CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.CONCEIRGE_LHN_GBR + : CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.LHN_WORKSPACE_CHAT_TOOLTIP; if (shouldShowRBRorGPRTooltip) { tooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GBR_RBR_CHAT; } From 04608cb54075ea8cdc06e58381a93fdf25144fbb Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Mon, 17 Mar 2025 02:21:40 +0100 Subject: [PATCH 03/26] correct comment --- src/types/onyx/DismissedProductTraining.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/onyx/DismissedProductTraining.ts b/src/types/onyx/DismissedProductTraining.ts index 981a409880f0f..066776bf5e4ef 100644 --- a/src/types/onyx/DismissedProductTraining.ts +++ b/src/types/onyx/DismissedProductTraining.ts @@ -85,7 +85,7 @@ type DismissedProductTraining = { [ACCOUNT_SWITCHER]: string; /** - * When user dismisses the gbrRbrChat product training tooltip, we store the timestamp here. + * When user dismisses the chatGBRRBR product training tooltip, we store the timestamp here. */ [GBR_RBR_CHAT]: string; From a03d03267f8d2bc86876d5dbd60ce66b3b91d7ee Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Mon, 17 Mar 2025 02:27:35 +0100 Subject: [PATCH 04/26] disable concierge tooltip --- src/components/ProductTrainingContext/TOOLTIPS.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ProductTrainingContext/TOOLTIPS.ts b/src/components/ProductTrainingContext/TOOLTIPS.ts index 9578d4c13c0db..4eba0330625fa 100644 --- a/src/components/ProductTrainingContext/TOOLTIPS.ts +++ b/src/components/ProductTrainingContext/TOOLTIPS.ts @@ -43,7 +43,7 @@ const TOOLTIPS: Record = { onHideTooltip: () => dismissProductTraining(CONCEIRGE_LHN_GBR), name: CONCEIRGE_LHN_GBR, priority: 1300, - shouldShow: ({shouldUseNarrowLayout}) => !!shouldUseNarrowLayout, + shouldShow: () => false, }, [RENAME_SAVED_SEARCH]: { content: [ From 467f51e91874ebccdd4420268250f688e1e4f111 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Mon, 17 Mar 2025 02:46:46 +0100 Subject: [PATCH 05/26] fix test --- tests/ui/components/ProductTrainingContextProvider.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ui/components/ProductTrainingContextProvider.tsx b/tests/ui/components/ProductTrainingContextProvider.tsx index 6bc131f80be2d..acf0124848a93 100644 --- a/tests/ui/components/ProductTrainingContextProvider.tsx +++ b/tests/ui/components/ProductTrainingContextProvider.tsx @@ -208,7 +208,7 @@ describe('ProductTrainingContextProvider', () => { await waitForBatchedUpdatesWithAct(); // Then narrow layout tooltip should show - expect(result.current.shouldShowProductTrainingTooltip).toBe(true); + expect(result.current.shouldShowProductTrainingTooltip).toBe(false); }); it('should handle wide layout specific tooltips based on screen width', async () => { // When narrow layout is true From 43aeacc2af5bfd935dc05c94f9775baefa23e557 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Tue, 18 Mar 2025 16:16:58 +0100 Subject: [PATCH 06/26] hide account switcher tooltip when the settings page is not focused --- src/components/AccountSwitcher.tsx | 9 +++++++-- src/libs/Navigation/helpers/useRouteActive.ts | 16 ++++++++++++++++ src/pages/settings/InitialSettingsPage.tsx | 7 ++++++- 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 src/libs/Navigation/helpers/useRouteActive.ts diff --git a/src/components/AccountSwitcher.tsx b/src/components/AccountSwitcher.tsx index ea4eec2290562..abef6df1e4a29 100644 --- a/src/components/AccountSwitcher.tsx +++ b/src/components/AccountSwitcher.tsx @@ -30,7 +30,12 @@ import {useProductTrainingContext} from './ProductTrainingContext'; import Text from './Text'; import EducationalTooltip from './Tooltip/EducationalTooltip'; -function AccountSwitcher() { +type AccountSwitcherProps = { + /* Whether the screen is focused. Used to hide the product training tooltip */ + isScreenFocused: boolean; +}; + +function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) { const currentUserPersonalDetails = useCurrentUserPersonalDetails(); const styles = useThemeStyles(); const theme = useTheme(); @@ -53,7 +58,7 @@ function AccountSwitcher() { const {shouldShowProductTrainingTooltip, renderProductTrainingTooltip, hideProductTrainingTooltip} = useProductTrainingContext( CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.ACCOUNT_SWITCHER, - canSwitchAccounts, + isScreenFocused && canSwitchAccounts, ); const createBaseMenuItem = ( diff --git a/src/libs/Navigation/helpers/useRouteActive.ts b/src/libs/Navigation/helpers/useRouteActive.ts new file mode 100644 index 0000000000000..7a660cc4f0cc5 --- /dev/null +++ b/src/libs/Navigation/helpers/useRouteActive.ts @@ -0,0 +1,16 @@ +import {findFocusedRoute, useNavigationState} from '@react-navigation/native'; +import useRootNavigationState from '@hooks/useRootNavigationState'; +import NAVIGATORS from '@src/NAVIGATORS'; +import SCREENS from '@src/SCREENS'; + +function useIsAccountSettingsRouteActive(isNarrowLayout: boolean) { + const focusedRoute = useNavigationState(findFocusedRoute); + const navigationState = useRootNavigationState((x) => x); + + const isSplit = navigationState?.routes.at(-1)?.name === NAVIGATORS.SETTINGS_SPLIT_NAVIGATOR; + const isAccountSettings = focusedRoute?.name === SCREENS.SETTINGS.ROOT; + + return isNarrowLayout ? isAccountSettings : isSplit; +} + +export default useIsAccountSettingsRouteActive; \ No newline at end of file diff --git a/src/pages/settings/InitialSettingsPage.tsx b/src/pages/settings/InitialSettingsPage.tsx index 4833b33ca9b93..eece9206bb823 100755 --- a/src/pages/settings/InitialSettingsPage.tsx +++ b/src/pages/settings/InitialSettingsPage.tsx @@ -26,12 +26,14 @@ import type {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentU import withCurrentUserPersonalDetails from '@components/withCurrentUserPersonalDetails'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; +import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useSingleExecution from '@hooks/useSingleExecution'; import useSubscriptionPlan from '@hooks/useSubscriptionPlan'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import {resetExitSurveyForm} from '@libs/actions/ExitSurvey'; import {convertToDisplayString} from '@libs/CurrencyUtils'; +import useIsAccountSettingsRouteActive from '@libs/Navigation/helpers/useRouteActive'; import Navigation from '@libs/Navigation/Navigation'; import {getFreeTrialText, hasSubscriptionRedDotError} from '@libs/SubscriptionUtils'; import {getProfilePageBrickRoadIndicator} from '@libs/UserUtils'; @@ -113,6 +115,9 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr const freeTrialText = getFreeTrialText(policies); const shouldOpenBookACall = tryNewDot?.classicRedirect?.dismissed === false; + const {shouldUseNarrowLayout} = useResponsiveLayout(); + const isScreenFocused = useIsAccountSettingsRouteActive(shouldUseNarrowLayout); + useEffect(() => { openInitialSettingsPage(); confirmReadyToOpenApp(); @@ -375,7 +380,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr ) : ( - + Date: Tue, 18 Mar 2025 16:33:55 +0100 Subject: [PATCH 07/26] prettier --- src/libs/Navigation/helpers/useRouteActive.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/helpers/useRouteActive.ts b/src/libs/Navigation/helpers/useRouteActive.ts index 7a660cc4f0cc5..725780bd1e14d 100644 --- a/src/libs/Navigation/helpers/useRouteActive.ts +++ b/src/libs/Navigation/helpers/useRouteActive.ts @@ -13,4 +13,4 @@ function useIsAccountSettingsRouteActive(isNarrowLayout: boolean) { return isNarrowLayout ? isAccountSettings : isSplit; } -export default useIsAccountSettingsRouteActive; \ No newline at end of file +export default useIsAccountSettingsRouteActive; From 28cb984293750ee2296b837cfb4739f1ce1503a5 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Mon, 24 Mar 2025 17:25:35 +0100 Subject: [PATCH 08/26] revert a change --- src/components/ProductTrainingContext/TOOLTIPS.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ProductTrainingContext/TOOLTIPS.ts b/src/components/ProductTrainingContext/TOOLTIPS.ts index f8a852f5b5286..8854f9be1e69c 100644 --- a/src/components/ProductTrainingContext/TOOLTIPS.ts +++ b/src/components/ProductTrainingContext/TOOLTIPS.ts @@ -84,7 +84,7 @@ const TOOLTIPS: Record = { ], onHideTooltip: (isDismissedUsingCloseButton = false) => dismissProductTraining(LHN_WORKSPACE_CHAT_TOOLTIP, isDismissedUsingCloseButton), name: LHN_WORKSPACE_CHAT_TOOLTIP, - priority: 1800, + priority: 800, shouldShow: () => true, }, [GBR_RBR_CHAT]: { From f25fa907deac9c14ccb9c1615c0fac0c123e4a30 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Mon, 24 Mar 2025 17:33:45 +0100 Subject: [PATCH 09/26] Add close button changes --- src/components/ProductTrainingContext/TOOLTIPS.ts | 4 ++-- src/types/onyx/DismissedProductTraining.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/ProductTrainingContext/TOOLTIPS.ts b/src/components/ProductTrainingContext/TOOLTIPS.ts index 8854f9be1e69c..b7caae5645dd7 100644 --- a/src/components/ProductTrainingContext/TOOLTIPS.ts +++ b/src/components/ProductTrainingContext/TOOLTIPS.ts @@ -94,7 +94,7 @@ const TOOLTIPS: Record = { {text: 'productTrainingTooltip.GBRRBRChat.part3', isBold: false}, {text: 'productTrainingTooltip.GBRRBRChat.part4', isBold: true}, ], - onHideTooltip: () => dismissProductTraining(GBR_RBR_CHAT), + onHideTooltip: (isDismissedUsingCloseButton = false) => dismissProductTraining(GBR_RBR_CHAT, isDismissedUsingCloseButton), name: GBR_RBR_CHAT, priority: 1900, shouldShow: () => true, @@ -105,7 +105,7 @@ const TOOLTIPS: Record = { {text: 'productTrainingTooltip.accountSwitcher.part2', isBold: true}, {text: 'productTrainingTooltip.accountSwitcher.part3', isBold: false}, ], - onHideTooltip: () => dismissProductTraining(ACCOUNT_SWITCHER), + onHideTooltip: (isDismissedUsingCloseButton = false) => dismissProductTraining(ACCOUNT_SWITCHER, isDismissedUsingCloseButton), name: ACCOUNT_SWITCHER, priority: 1600, shouldShow: () => true, diff --git a/src/types/onyx/DismissedProductTraining.ts b/src/types/onyx/DismissedProductTraining.ts index d65cf1e9073b3..da7128eb51c9e 100644 --- a/src/types/onyx/DismissedProductTraining.ts +++ b/src/types/onyx/DismissedProductTraining.ts @@ -77,12 +77,12 @@ type DismissedProductTraining = { /** * When user dismisses the accountSwitcher product training tooltip, we store the timestamp here. */ - [ACCOUNT_SWITCHER]: string; + [ACCOUNT_SWITCHER]: DismissedProductTrainingElement; /** * When user dismisses the chatGBRRBR product training tooltip, we store the timestamp here. */ - [GBR_RBR_CHAT]: string; + [GBR_RBR_CHAT]: DismissedProductTrainingElement; /** * When user dismisses the ChangeReportPolicy feature training modal, we store the timestamp here. From f9c95e5fbe2568f05051d22d52dc8d0fa8ee9ebc Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Mon, 24 Mar 2025 17:56:26 +0100 Subject: [PATCH 10/26] lint --- src/components/AccountSwitcher.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/AccountSwitcher.tsx b/src/components/AccountSwitcher.tsx index abef6df1e4a29..d2f31561334af 100644 --- a/src/components/AccountSwitcher.tsx +++ b/src/components/AccountSwitcher.tsx @@ -52,7 +52,7 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) { const [shouldShowOfflineModal, setShouldShowOfflineModal] = useState(false); const delegators = account?.delegatedAccess?.delegators ?? []; - const isActingAsDelegate = !!account?.delegatedAccess?.delegate ?? false; + const isActingAsDelegate = !!account?.delegatedAccess?.delegate; const canSwitchAccounts = delegators.length > 0 || isActingAsDelegate; const processedTextArray = splitTextWithEmojis(currentUserPersonalDetails?.displayName); From 4e3bfe722064a7b1556dff074ac4c19bc5093a49 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Mon, 31 Mar 2025 00:54:47 +0100 Subject: [PATCH 11/26] Enhance tooltip alignment logic --- src/components/LHNOptionsList/OptionRowLHN.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/LHNOptionsList/OptionRowLHN.tsx b/src/components/LHNOptionsList/OptionRowLHN.tsx index cdc2de0de5164..7711d575ca4de 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.tsx +++ b/src/components/LHNOptionsList/OptionRowLHN.tsx @@ -80,7 +80,7 @@ function OptionRowLHN({ const isReportsSplitNavigatorLast = useRootNavigationState((state) => state?.routes?.at(-1)?.name === NAVIGATORS.REPORTS_SPLIT_NAVIGATOR); - const {tooltipToRender, shouldShowTooltip} = useMemo(() => { + const {tooltipToRender, shouldShowTooltip, shouldTooltipBeLeftAligned} = useMemo(() => { // TODO: CONCEIRGE_LHN_GBR tooltip will be replaced by a tooltip in the #admins room // https://github.com/Expensify/App/issues/57045#issuecomment-2701455668 let tooltip: ProductTrainingTooltipName = shouldShowGetStartedTooltip @@ -93,7 +93,11 @@ function OptionRowLHN({ const shouldTooltipBeVisible = shouldUseNarrowLayout ? isScreenFocused && isReportsSplitNavigatorLast : isReportsSplitNavigatorLast && !isFullscreenVisible; // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - return {tooltipToRender: tooltip, shouldShowTooltip: shouldShowTooltips && shouldTooltipBeVisible}; + return { + tooltipToRender: tooltip, + shouldShowTooltip: shouldShowTooltips && shouldTooltipBeVisible, + shouldTooltipBeLeftAligned: shouldShowWokspaceChatTooltip && !shouldShowRBRorGPRTooltip && !shouldShowGetStartedTooltip, + }; }, [shouldShowRBRorGPRTooltip, shouldShowGetStartedTooltip, shouldShowWokspaceChatTooltip, isScreenFocused, shouldUseNarrowLayout, isReportsSplitNavigatorLast, isFullscreenVisible]); const {shouldShowProductTrainingTooltip, renderProductTrainingTooltip, hideProductTrainingTooltip} = useProductTrainingContext(tooltipToRender, shouldShowTooltip); @@ -211,11 +215,11 @@ function OptionRowLHN({ shouldRender={shouldShowProductTrainingTooltip} renderTooltipContent={renderProductTrainingTooltip} anchorAlignment={{ - horizontal: shouldShowWokspaceChatTooltip ? CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT : CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT, + horizontal: shouldTooltipBeLeftAligned ? CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT : CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT, vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP, }} - shiftHorizontal={shouldShowWokspaceChatTooltip ? variables.workspaceLHNTooltipShiftHorizontal : variables.gbrTooltipShiftHorizontal} - shiftVertical={shouldShowWokspaceChatTooltip ? 0 : variables.gbrTooltipShiftVertical} + shiftHorizontal={shouldTooltipBeLeftAligned ? variables.workspaceLHNTooltipShiftHorizontal : variables.gbrTooltipShiftHorizontal} + shiftVertical={shouldTooltipBeLeftAligned ? 0 : variables.gbrTooltipShiftVertical} wrapperStyle={styles.productTrainingTooltipWrapper} onTooltipPress={onOptionPress} shouldHideOnScroll From 92062a113d4d9c7606cc48de979751cc28f6f65c Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Mon, 31 Mar 2025 01:00:04 +0100 Subject: [PATCH 12/26] fix lint --- src/components/ProductTrainingContext/TOOLTIPS.ts | 4 ++-- src/types/onyx/DismissedProductTraining.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/ProductTrainingContext/TOOLTIPS.ts b/src/components/ProductTrainingContext/TOOLTIPS.ts index c15b308434419..2fab1e002834f 100644 --- a/src/components/ProductTrainingContext/TOOLTIPS.ts +++ b/src/components/ProductTrainingContext/TOOLTIPS.ts @@ -94,7 +94,7 @@ const TOOLTIPS: Record = { {text: 'productTrainingTooltip.GBRRBRChat.part3', isBold: false}, {text: 'productTrainingTooltip.GBRRBRChat.part4', isBold: true}, ], - onHideTooltip: (isDismissedUsingCloseButton = false) => dismissProductTraining(GBR_RBR_CHAT, isDismissedUsingCloseButton), + onHideTooltip: () => dismissProductTraining(GBR_RBR_CHAT), name: GBR_RBR_CHAT, priority: 1900, shouldShow: () => true, @@ -105,7 +105,7 @@ const TOOLTIPS: Record = { {text: 'productTrainingTooltip.accountSwitcher.part2', isBold: true}, {text: 'productTrainingTooltip.accountSwitcher.part3', isBold: false}, ], - onHideTooltip: (isDismissedUsingCloseButton = false) => dismissProductTraining(ACCOUNT_SWITCHER, isDismissedUsingCloseButton), + onHideTooltip: () => dismissProductTraining(ACCOUNT_SWITCHER), name: ACCOUNT_SWITCHER, priority: 1600, shouldShow: () => true, diff --git a/src/types/onyx/DismissedProductTraining.ts b/src/types/onyx/DismissedProductTraining.ts index bc83c6d43d44c..2a34aa4b15f6e 100644 --- a/src/types/onyx/DismissedProductTraining.ts +++ b/src/types/onyx/DismissedProductTraining.ts @@ -66,12 +66,12 @@ type DismissedProductTraining = { /** * When user dismisses the accountSwitcher product training tooltip, we store the timestamp here. */ - [ACCOUNT_SWITCHER]: DismissedProductTrainingElement; + [ACCOUNT_SWITCHER]: string; /** * When user dismisses the chatGBRRBR product training tooltip, we store the timestamp here. */ - [GBR_RBR_CHAT]: DismissedProductTrainingElement; + [GBR_RBR_CHAT]: string; /** * When user dismisses the ChangeReportPolicy feature training modal, we store the timestamp here. From ccaf45ef9fd95947b00b8213dcdc7e2f3a1b52eb Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:15:38 +0100 Subject: [PATCH 13/26] update translations --- src/languages/es.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 7ef367f8ddfb8..ebe5ce40d824a 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -6746,13 +6746,13 @@ const translations = { }, GBRRBRChat: { part1: 'Verás 🟢 en ', - part2: 'acciones a realizar', - part3: ',\ny 🔴 en ', - part4: 'errores para revisar.', + part2: 'las acciones a realizar', + part3: '\ny 🔴 en ', + part4: 'los errores que debes revisar.', }, accountSwitcher: { part1: 'Accede a tus ', - part2: 'cuentas Copilot', + part2: 'cuentas copiloto', part3: ' aquí', }, scanTestTooltip: { From 461c2f19704c778198f270c2bef998c40c934a4d Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:27:23 +0100 Subject: [PATCH 14/26] Fix conflict --- src/pages/settings/InitialSettingsPage.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pages/settings/InitialSettingsPage.tsx b/src/pages/settings/InitialSettingsPage.tsx index a283c99403f88..971893a50fc19 100755 --- a/src/pages/settings/InitialSettingsPage.tsx +++ b/src/pages/settings/InitialSettingsPage.tsx @@ -27,7 +27,6 @@ import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import usePermissions from '@hooks/usePermissions'; -import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useSingleExecution from '@hooks/useSingleExecution'; import useSubscriptionPlan from '@hooks/useSubscriptionPlan'; import useTheme from '@hooks/useTheme'; @@ -120,7 +119,6 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr const freeTrialText = getFreeTrialText(policies); const shouldOpenBookACall = tryNewDot?.classicRedirect?.dismissed === false; - const {shouldUseNarrowLayout} = useResponsiveLayout(); const isScreenFocused = useIsAccountSettingsRouteActive(shouldUseNarrowLayout); useEffect(() => { From e800c423ece25c07ff6568da986865888b801913 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:33:50 +0100 Subject: [PATCH 15/26] correct type --- src/types/onyx/DismissedProductTraining.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types/onyx/DismissedProductTraining.ts b/src/types/onyx/DismissedProductTraining.ts index d65cf1e9073b3..da7128eb51c9e 100644 --- a/src/types/onyx/DismissedProductTraining.ts +++ b/src/types/onyx/DismissedProductTraining.ts @@ -77,12 +77,12 @@ type DismissedProductTraining = { /** * When user dismisses the accountSwitcher product training tooltip, we store the timestamp here. */ - [ACCOUNT_SWITCHER]: string; + [ACCOUNT_SWITCHER]: DismissedProductTrainingElement; /** * When user dismisses the chatGBRRBR product training tooltip, we store the timestamp here. */ - [GBR_RBR_CHAT]: string; + [GBR_RBR_CHAT]: DismissedProductTrainingElement; /** * When user dismisses the ChangeReportPolicy feature training modal, we store the timestamp here. From d67e5a74bade0a60ef04d7c0c8eb29a3d6c8afd6 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:34:03 +0100 Subject: [PATCH 16/26] prettier --- src/components/AccountSwitcher.tsx | 110 +++++++++++---------- src/pages/settings/InitialSettingsPage.tsx | 2 +- 2 files changed, 57 insertions(+), 55 deletions(-) diff --git a/src/components/AccountSwitcher.tsx b/src/components/AccountSwitcher.tsx index d3cfd60b77687..d357e60107386 100644 --- a/src/components/AccountSwitcher.tsx +++ b/src/components/AccountSwitcher.tsx @@ -29,8 +29,8 @@ import PopoverMenu from './PopoverMenu'; import {PressableWithFeedback} from './Pressable'; import {useProductTrainingContext} from './ProductTrainingContext'; import Text from './Text'; -import EducationalTooltip from './Tooltip/EducationalTooltip'; import Tooltip from './Tooltip'; +import EducationalTooltip from './Tooltip/EducationalTooltip'; type AccountSwitcherProps = { /* Whether the screen is focused. Used to hide the product training tooltip */ @@ -160,67 +160,69 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) { wrapperStyle={styles.productTrainingTooltipWrapper} onTooltipPress={onPressSwitcher} > - - - - - - + + + + + + + {processedTextArray.length !== 0 + ? getProcessedText(processedTextArray, styles.initialSettingsUsernameEmoji) + : currentUserPersonalDetails?.displayName} + + {!!canSwitchAccounts && ( + + + + )} + - {processedTextArray.length !== 0 ? getProcessedText(processedTextArray, styles.initialSettingsUsernameEmoji) : currentUserPersonalDetails?.displayName} + {Str.removeSMSDomain(currentUserPersonalDetails?.login ?? '')} - {!!canSwitchAccounts && ( - - - + {!!user?.isDebugModeEnabled && ( + + AccountID: {session?.accountID} + )} - - {Str.removeSMSDomain(currentUserPersonalDetails?.login ?? '')} - - {!!user?.isDebugModeEnabled && ( - - AccountID: {session?.accountID} - - )} - - - + + {!!canSwitchAccounts && ( diff --git a/src/pages/settings/InitialSettingsPage.tsx b/src/pages/settings/InitialSettingsPage.tsx index 971893a50fc19..cf8e46376494d 100755 --- a/src/pages/settings/InitialSettingsPage.tsx +++ b/src/pages/settings/InitialSettingsPage.tsx @@ -25,8 +25,8 @@ import type {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentU import withCurrentUserPersonalDetails from '@components/withCurrentUserPersonalDetails'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; -import useResponsiveLayout from '@hooks/useResponsiveLayout'; import usePermissions from '@hooks/usePermissions'; +import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useSingleExecution from '@hooks/useSingleExecution'; import useSubscriptionPlan from '@hooks/useSubscriptionPlan'; import useTheme from '@hooks/useTheme'; From 244ad46b49e0ca0165431b310c44d850a1e21f63 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:50:00 +0100 Subject: [PATCH 17/26] fix Changed files ESLint check errors --- src/components/AccountSwitcher.tsx | 6 +++--- .../LHNOptionsList/LHNOptionsList.tsx | 16 +++++++-------- .../LHNOptionsList/OptionRowLHN.tsx | 6 +++--- src/pages/settings/InitialSettingsPage.tsx | 20 +++++++++---------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/components/AccountSwitcher.tsx b/src/components/AccountSwitcher.tsx index d357e60107386..ec397ab1540fa 100644 --- a/src/components/AccountSwitcher.tsx +++ b/src/components/AccountSwitcher.tsx @@ -44,9 +44,9 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) { const {translate} = useLocalize(); const {isOffline} = useNetwork(); const {shouldUseNarrowLayout} = useResponsiveLayout(); - const [account] = useOnyx(ONYXKEYS.ACCOUNT); - const [session] = useOnyx(ONYXKEYS.SESSION); - const [user] = useOnyx(ONYXKEYS.USER); + const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true}); + const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: true}); + const [user] = useOnyx(ONYXKEYS.USER, {canBeMissing: true}); const buttonRef = useRef(null); const {windowHeight} = useWindowDimensions(); const {canUseLeftHandBar} = usePermissions(); diff --git a/src/components/LHNOptionsList/LHNOptionsList.tsx b/src/components/LHNOptionsList/LHNOptionsList.tsx index c478a4b60c7e3..cb0d433b1fa28 100644 --- a/src/components/LHNOptionsList/LHNOptionsList.tsx +++ b/src/components/LHNOptionsList/LHNOptionsList.tsx @@ -41,14 +41,14 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio const flashListRef = useRef>(null); const route = useRoute(); - const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT); - const [reportNameValuePairs] = useOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS); - const [reportActions] = useOnyx(ONYXKEYS.COLLECTION.REPORT_ACTIONS); - const [policy] = useOnyx(ONYXKEYS.COLLECTION.POLICY); - const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); - const [transactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION); - const [draftComments] = useOnyx(ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT); - const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS); + const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: true}); + const [reportNameValuePairs] = useOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS, {canBeMissing: true}); + const [reportActions] = useOnyx(ONYXKEYS.COLLECTION.REPORT_ACTIONS, {canBeMissing: true}); + const [policy] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true}); + const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {canBeMissing: true}); + const [transactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION, {canBeMissing: true}); + const [draftComments] = useOnyx(ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT, {canBeMissing: true}); + const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, {canBeMissing: true}); const theme = useTheme(); const styles = useThemeStyles(); diff --git a/src/components/LHNOptionsList/OptionRowLHN.tsx b/src/components/LHNOptionsList/OptionRowLHN.tsx index 7711d575ca4de..e995029099f10 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.tsx +++ b/src/components/LHNOptionsList/OptionRowLHN.tsx @@ -69,9 +69,9 @@ function OptionRowLHN({ const {shouldUseNarrowLayout} = useResponsiveLayout(); const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${optionItem?.reportID}`); - const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID); - const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); - const [isFullscreenVisible] = useOnyx(ONYXKEYS.FULLSCREEN_VISIBILITY); + const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID, {canBeMissing: true}); + const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {canBeMissing: true}); + const [isFullscreenVisible] = useOnyx(ONYXKEYS.FULLSCREEN_VISIBILITY, {canBeMissing: true}); const session = useSession(); const shouldShowWokspaceChatTooltip = isPolicyExpenseChat(report) && !isThread(report) && activePolicyID === report?.policyID && session?.accountID === report?.ownerAccountID; const isOnboardingGuideAssigned = introSelected?.choice === CONST.ONBOARDING_CHOICES.MANAGE_TEAM && !session?.email?.includes('+'); diff --git a/src/pages/settings/InitialSettingsPage.tsx b/src/pages/settings/InitialSettingsPage.tsx index cf8e46376494d..be32993b08251 100755 --- a/src/pages/settings/InitialSettingsPage.tsx +++ b/src/pages/settings/InitialSettingsPage.tsx @@ -84,15 +84,15 @@ type MenuData = { type Menu = {sectionStyle: StyleProp; sectionTranslationKey: TranslationPaths; items: MenuData[]}; function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPageProps) { - const [userWallet] = useOnyx(ONYXKEYS.USER_WALLET); - const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST); - const [fundList] = useOnyx(ONYXKEYS.FUND_LIST); - const [walletTerms] = useOnyx(ONYXKEYS.WALLET_TERMS); - const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST); - const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY); - const [privatePersonalDetails] = useOnyx(ONYXKEYS.PRIVATE_PERSONAL_DETAILS); - const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRYNEWDOT); - const [allCards] = useOnyx(`${ONYXKEYS.CARD_LIST}`); + const [userWallet] = useOnyx(ONYXKEYS.USER_WALLET, {canBeMissing: true}); + const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST, {canBeMissing: true}); + const [fundList] = useOnyx(ONYXKEYS.FUND_LIST, {canBeMissing: true}); + const [walletTerms] = useOnyx(ONYXKEYS.WALLET_TERMS, {canBeMissing: true}); + const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST, {canBeMissing: true}); + const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true}); + const [privatePersonalDetails] = useOnyx(ONYXKEYS.PRIVATE_PERSONAL_DETAILS, {canBeMissing: true}); + const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRYNEWDOT, {canBeMissing: true}); + const [allCards] = useOnyx(ONYXKEYS.CARD_LIST, , {canBeMissing: true}); const {shouldUseNarrowLayout} = useResponsiveLayout(); const network = useNetwork(); @@ -108,7 +108,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr const {canUseLeftHandBar} = usePermissions(); const shouldDisplayLHB = canUseLeftHandBar && !shouldUseNarrowLayout; - const [privateSubscription] = useOnyx(ONYXKEYS.NVP_PRIVATE_SUBSCRIPTION); + const [privateSubscription] = useOnyx(ONYXKEYS.NVP_PRIVATE_SUBSCRIPTION, {canBeMissing: true}); const subscriptionPlan = useSubscriptionPlan(); const hasBrokenFeedConnection = checkIfFeedConnectionIsBroken(allCards, CONST.EXPENSIFY_CARD.BANK); const walletBrickRoadIndicator = From 50ab69939472c3d1f5edd26a59152ce04f641c38 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:53:50 +0100 Subject: [PATCH 18/26] fix: remove syntax error in useOnyx for allCards --- src/pages/settings/InitialSettingsPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/settings/InitialSettingsPage.tsx b/src/pages/settings/InitialSettingsPage.tsx index be32993b08251..0d8e98dba1149 100755 --- a/src/pages/settings/InitialSettingsPage.tsx +++ b/src/pages/settings/InitialSettingsPage.tsx @@ -92,7 +92,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true}); const [privatePersonalDetails] = useOnyx(ONYXKEYS.PRIVATE_PERSONAL_DETAILS, {canBeMissing: true}); const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRYNEWDOT, {canBeMissing: true}); - const [allCards] = useOnyx(ONYXKEYS.CARD_LIST, , {canBeMissing: true}); + const [allCards] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: true}); const {shouldUseNarrowLayout} = useResponsiveLayout(); const network = useNetwork(); From 79d6779f733cf265003dc962fecdeb50192f4861 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Wed, 23 Apr 2025 17:21:22 +0100 Subject: [PATCH 19/26] refactor tooltip rendering in AccountSwitcher component --- src/components/AccountSwitcher.tsx | 139 +++++++++++++++-------------- 1 file changed, 70 insertions(+), 69 deletions(-) diff --git a/src/components/AccountSwitcher.tsx b/src/components/AccountSwitcher.tsx index ec397ab1540fa..6390df4bf44c2 100644 --- a/src/components/AccountSwitcher.tsx +++ b/src/components/AccountSwitcher.tsx @@ -64,6 +64,28 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) { CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.ACCOUNT_SWITCHER, isScreenFocused && canSwitchAccounts, ); + const TooltipToRender = shouldShowProductTrainingTooltip ? EducationalTooltip : Tooltip; + const tooltipProps = shouldShowProductTrainingTooltip + ? { + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + shouldRender: shouldShowProductTrainingTooltip, + renderTooltipContent: renderProductTrainingTooltip, + anchorAlignment: { + horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT, + vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP, + }, + shiftVertical: variables.accountSwitcherTooltipShiftVertical, + shiftHorizontal: variables.accountSwitcherTooltipShiftHorizontal, + wrapperStyle: styles.productTrainingTooltipWrapper, + onTooltipPress: onPressSwitcher, + } + : { + text: translate('delegate.copilotAccess'), + shiftVertical: 8, + shiftHorizontal: 8, + anchorAlignment: {horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT, vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM}, + shouldRender: canSwitchAccounts, + }; const createBaseMenuItem = ( personalDetails: PersonalDetails | undefined, @@ -147,83 +169,62 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) { return ( <> - - + - - - - - - - {processedTextArray.length !== 0 - ? getProcessedText(processedTextArray, styles.initialSettingsUsernameEmoji) - : currentUserPersonalDetails?.displayName} - - {!!canSwitchAccounts && ( - - - - )} - + + + + - {Str.removeSMSDomain(currentUserPersonalDetails?.login ?? '')} + {processedTextArray.length !== 0 ? getProcessedText(processedTextArray, styles.initialSettingsUsernameEmoji) : currentUserPersonalDetails?.displayName} - {!!user?.isDebugModeEnabled && ( - - AccountID: {session?.accountID} - + {!!canSwitchAccounts && ( + + + )} + + {Str.removeSMSDomain(currentUserPersonalDetails?.login ?? '')} + + {!!user?.isDebugModeEnabled && ( + + AccountID: {session?.accountID} + + )} - - - + + + {!!canSwitchAccounts && ( Date: Wed, 23 Apr 2025 17:22:59 +0100 Subject: [PATCH 20/26] move onPressSwitcher function --- src/components/AccountSwitcher.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/AccountSwitcher.tsx b/src/components/AccountSwitcher.tsx index 6390df4bf44c2..d50678d4341b9 100644 --- a/src/components/AccountSwitcher.tsx +++ b/src/components/AccountSwitcher.tsx @@ -64,6 +64,12 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) { CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.ACCOUNT_SWITCHER, isScreenFocused && canSwitchAccounts, ); + + const onPressSwitcher = () => { + hideProductTrainingTooltip(); + setShouldShowDelegatorMenu(!shouldShowDelegatorMenu); + }; + const TooltipToRender = shouldShowProductTrainingTooltip ? EducationalTooltip : Tooltip; const tooltipProps = shouldShowProductTrainingTooltip ? { @@ -162,11 +168,6 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) { return [currentUserMenuItem, ...delegatorMenuItems]; }; - const onPressSwitcher = () => { - hideProductTrainingTooltip(); - setShouldShowDelegatorMenu(!shouldShowDelegatorMenu); - }; - return ( <> {/* eslint-disable-next-line react/jsx-props-no-spreading */} From b2711ba5ed9e25ca832a2b07dd52820a23aa07cc Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Wed, 23 Apr 2025 17:24:12 +0100 Subject: [PATCH 21/26] remove unecessary comment --- src/components/AccountSwitcher.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/AccountSwitcher.tsx b/src/components/AccountSwitcher.tsx index d50678d4341b9..abd7717e9e426 100644 --- a/src/components/AccountSwitcher.tsx +++ b/src/components/AccountSwitcher.tsx @@ -69,11 +69,10 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) { hideProductTrainingTooltip(); setShouldShowDelegatorMenu(!shouldShowDelegatorMenu); }; - + const TooltipToRender = shouldShowProductTrainingTooltip ? EducationalTooltip : Tooltip; const tooltipProps = shouldShowProductTrainingTooltip ? { - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing shouldRender: shouldShowProductTrainingTooltip, renderTooltipContent: renderProductTrainingTooltip, anchorAlignment: { From a4edee28789901d516c7cadbb3287de11dd5e031 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Thu, 1 May 2025 01:11:19 +0100 Subject: [PATCH 22/26] fix lint errors --- src/components/LHNOptionsList/OptionRowLHN.tsx | 10 +++++----- src/pages/settings/InitialSettingsPage.tsx | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/LHNOptionsList/OptionRowLHN.tsx b/src/components/LHNOptionsList/OptionRowLHN.tsx index dc4c9fbeec289..effef7d80a174 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.tsx +++ b/src/components/LHNOptionsList/OptionRowLHN.tsx @@ -81,24 +81,24 @@ function OptionRowLHN({ const isReportsSplitNavigatorLast = useRootNavigationState((state) => state?.routes?.at(-1)?.name === NAVIGATORS.REPORTS_SPLIT_NAVIGATOR); const {tooltipToRender, shouldShowTooltip, shouldTooltipBeLeftAligned} = useMemo(() => { - // TODO: CONCEIRGE_LHN_GBR tooltip will be replaced by a tooltip in the #admins room + // TODO: CONCIERGE_LHN_GBR tooltip will be replaced by a tooltip in the #admins room // https://github.com/Expensify/App/issues/57045#issuecomment-2701455668 let tooltip: ProductTrainingTooltipName = shouldShowGetStartedTooltip - ? CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.CONCEIRGE_LHN_GBR + ? CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.CONCIERGE_LHN_GBR : CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.LHN_WORKSPACE_CHAT_TOOLTIP; if (shouldShowRBRorGPRTooltip) { tooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GBR_RBR_CHAT; } - const shouldShowTooltips = shouldShowRBRorGPRTooltip || shouldShowWokspaceChatTooltip || shouldShowGetStartedTooltip; + const shouldShowTooltips = shouldShowRBRorGPRTooltip || shouldShowWorkspaceChatTooltip || shouldShowGetStartedTooltip; const shouldTooltipBeVisible = shouldUseNarrowLayout ? isScreenFocused && isReportsSplitNavigatorLast : isReportsSplitNavigatorLast && !isFullscreenVisible; // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing return { tooltipToRender: tooltip, shouldShowTooltip: shouldShowTooltips && shouldTooltipBeVisible, - shouldTooltipBeLeftAligned: shouldShowWokspaceChatTooltip && !shouldShowRBRorGPRTooltip && !shouldShowGetStartedTooltip, + shouldTooltipBeLeftAligned: shouldShowWorkspaceChatTooltip && !shouldShowRBRorGPRTooltip && !shouldShowGetStartedTooltip, }; - }, [shouldShowRBRorGPRTooltip, shouldShowGetStartedTooltip, shouldShowWokspaceChatTooltip, isScreenFocused, shouldUseNarrowLayout, isReportsSplitNavigatorLast, isFullscreenVisible]); + }, [shouldShowRBRorGPRTooltip, shouldShowGetStartedTooltip, shouldShowWorkspaceChatTooltip, isScreenFocused, shouldUseNarrowLayout, isReportsSplitNavigatorLast, isFullscreenVisible]); const {shouldShowProductTrainingTooltip, renderProductTrainingTooltip, hideProductTrainingTooltip} = useProductTrainingContext(tooltipToRender, shouldShowTooltip); diff --git a/src/pages/settings/InitialSettingsPage.tsx b/src/pages/settings/InitialSettingsPage.tsx index c86dd8d6edcfe..e8aad5ad9d9ea 100755 --- a/src/pages/settings/InitialSettingsPage.tsx +++ b/src/pages/settings/InitialSettingsPage.tsx @@ -91,7 +91,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST, {canBeMissing: true}); const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true}); const [privatePersonalDetails] = useOnyx(ONYXKEYS.PRIVATE_PERSONAL_DETAILS, {canBeMissing: true}); - const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRYNEWDOT, {canBeMissing: true}); + const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT, {canBeMissing: true}); const [allCards] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: true}); const {shouldUseNarrowLayout} = useResponsiveLayout(); From 66700b0ed780bfa9f50d345d6a83b9fd09a5bd4d Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Thu, 1 May 2025 01:17:32 +0100 Subject: [PATCH 23/26] Fix bug --- src/libs/Navigation/helpers/useRouteActive.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/Navigation/helpers/useRouteActive.ts b/src/libs/Navigation/helpers/useRouteActive.ts index 725780bd1e14d..286000cb4a299 100644 --- a/src/libs/Navigation/helpers/useRouteActive.ts +++ b/src/libs/Navigation/helpers/useRouteActive.ts @@ -7,10 +7,10 @@ function useIsAccountSettingsRouteActive(isNarrowLayout: boolean) { const focusedRoute = useNavigationState(findFocusedRoute); const navigationState = useRootNavigationState((x) => x); - const isSplit = navigationState?.routes.at(-1)?.name === NAVIGATORS.SETTINGS_SPLIT_NAVIGATOR; - const isAccountSettings = focusedRoute?.name === SCREENS.SETTINGS.ROOT; + const isSettingsSplitNavigator = navigationState?.routes.at(-1)?.name === NAVIGATORS.SETTINGS_SPLIT_NAVIGATOR; + const isAccountSettings = focusedRoute?.name === SCREENS.SETTINGS.ROOT || focusedRoute?.name === SCREENS.SETTINGS.PROFILE.ROOT; - return isNarrowLayout ? isAccountSettings : isSplit; + return isNarrowLayout ? isAccountSettings && isSettingsSplitNavigator : isSettingsSplitNavigator; } export default useIsAccountSettingsRouteActive; From 4b5c64b0038bf8fd4f5a9a6470b006cef35cabc3 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Thu, 1 May 2025 01:29:17 +0100 Subject: [PATCH 24/26] fix bug --- src/libs/Navigation/helpers/useRouteActive.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/helpers/useRouteActive.ts b/src/libs/Navigation/helpers/useRouteActive.ts index 286000cb4a299..58d1cadb34bf4 100644 --- a/src/libs/Navigation/helpers/useRouteActive.ts +++ b/src/libs/Navigation/helpers/useRouteActive.ts @@ -8,7 +8,7 @@ function useIsAccountSettingsRouteActive(isNarrowLayout: boolean) { const navigationState = useRootNavigationState((x) => x); const isSettingsSplitNavigator = navigationState?.routes.at(-1)?.name === NAVIGATORS.SETTINGS_SPLIT_NAVIGATOR; - const isAccountSettings = focusedRoute?.name === SCREENS.SETTINGS.ROOT || focusedRoute?.name === SCREENS.SETTINGS.PROFILE.ROOT; + const isAccountSettings = focusedRoute?.name === SCREENS.SETTINGS.ROOT; return isNarrowLayout ? isAccountSettings && isSettingsSplitNavigator : isSettingsSplitNavigator; } From 102d131ba36152252cc91305ba2ab1d2a3b33d90 Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Thu, 1 May 2025 01:32:18 +0100 Subject: [PATCH 25/26] fix lint --- src/components/LHNOptionsList/OptionRowLHN.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/LHNOptionsList/OptionRowLHN.tsx b/src/components/LHNOptionsList/OptionRowLHN.tsx index effef7d80a174..b326bc437b7fd 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.tsx +++ b/src/components/LHNOptionsList/OptionRowLHN.tsx @@ -68,7 +68,7 @@ function OptionRowLHN({ const [isScreenFocused, setIsScreenFocused] = useState(false); const {shouldUseNarrowLayout} = useResponsiveLayout(); - const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${optionItem?.reportID}`); + const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${optionItem?.reportID}`, {canBeMissing: true}); const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID, {canBeMissing: true}); const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {canBeMissing: true}); const [isFullscreenVisible] = useOnyx(ONYXKEYS.FULLSCREEN_VISIBILITY, {canBeMissing: true}); From 144e62a23451e8ff0ae80838876c9387193556ab Mon Sep 17 00:00:00 2001 From: Rayane <77965000+rayane-d@users.noreply.github.com> Date: Thu, 1 May 2025 20:20:58 +0100 Subject: [PATCH 26/26] fix spelling --- src/components/LHNOptionsList/LHNOptionsList.tsx | 8 ++++---- src/components/LHNOptionsList/OptionRowLHN.tsx | 10 +++++----- src/components/LHNOptionsList/types.ts | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/LHNOptionsList/LHNOptionsList.tsx b/src/components/LHNOptionsList/LHNOptionsList.tsx index 73ae734d93313..09b53e2a63b0c 100644 --- a/src/components/LHNOptionsList/LHNOptionsList.tsx +++ b/src/components/LHNOptionsList/LHNOptionsList.tsx @@ -61,7 +61,7 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio const isWebOrDesktop = platform === CONST.PLATFORM.WEB || platform === CONST.PLATFORM.DESKTOP; const {shouldShowProductTrainingTooltip} = useProductTrainingContext(CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GBR_RBR_CHAT, true); - const firstReportIDWithGBRorRGR = useMemo(() => { + const firstReportIDWithGBRorRBR = useMemo(() => { if (!shouldShowProductTrainingTooltip) { return undefined; } @@ -203,7 +203,7 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio } const lastMessageTextFromReport = getLastMessageTextForReport(itemFullReport, lastActorDetails, itemPolicy, itemReportNameValuePairs); - const shouldShowRBRorGPRTooltip = firstReportIDWithGBRorRGR === reportID; + const shouldShowRBRorGBRTooltip = firstReportIDWithGBRorRBR === reportID; return ( ); }, @@ -249,7 +249,7 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio transactionViolations, onLayoutItem, isOffline, - firstReportIDWithGBRorRGR, + firstReportIDWithGBRorRBR, ], ); diff --git a/src/components/LHNOptionsList/OptionRowLHN.tsx b/src/components/LHNOptionsList/OptionRowLHN.tsx index b326bc437b7fd..80223372ca807 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.tsx +++ b/src/components/LHNOptionsList/OptionRowLHN.tsx @@ -59,7 +59,7 @@ function OptionRowLHN({ style, onLayout = () => {}, hasDraftComment, - shouldShowRBRorGPRTooltip, + shouldShowRBRorGBRTooltip, }: OptionRowLHNProps) { const theme = useTheme(); const styles = useThemeStyles(); @@ -86,19 +86,19 @@ function OptionRowLHN({ let tooltip: ProductTrainingTooltipName = shouldShowGetStartedTooltip ? CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.CONCIERGE_LHN_GBR : CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.LHN_WORKSPACE_CHAT_TOOLTIP; - if (shouldShowRBRorGPRTooltip) { + if (shouldShowRBRorGBRTooltip) { tooltip = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GBR_RBR_CHAT; } - const shouldShowTooltips = shouldShowRBRorGPRTooltip || shouldShowWorkspaceChatTooltip || shouldShowGetStartedTooltip; + const shouldShowTooltips = shouldShowRBRorGBRTooltip || shouldShowWorkspaceChatTooltip || shouldShowGetStartedTooltip; const shouldTooltipBeVisible = shouldUseNarrowLayout ? isScreenFocused && isReportsSplitNavigatorLast : isReportsSplitNavigatorLast && !isFullscreenVisible; // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing return { tooltipToRender: tooltip, shouldShowTooltip: shouldShowTooltips && shouldTooltipBeVisible, - shouldTooltipBeLeftAligned: shouldShowWorkspaceChatTooltip && !shouldShowRBRorGPRTooltip && !shouldShowGetStartedTooltip, + shouldTooltipBeLeftAligned: shouldShowWorkspaceChatTooltip && !shouldShowRBRorGBRTooltip && !shouldShowGetStartedTooltip, }; - }, [shouldShowRBRorGPRTooltip, shouldShowGetStartedTooltip, shouldShowWorkspaceChatTooltip, isScreenFocused, shouldUseNarrowLayout, isReportsSplitNavigatorLast, isFullscreenVisible]); + }, [shouldShowRBRorGBRTooltip, shouldShowGetStartedTooltip, shouldShowWorkspaceChatTooltip, isScreenFocused, shouldUseNarrowLayout, isReportsSplitNavigatorLast, isFullscreenVisible]); const {shouldShowProductTrainingTooltip, renderProductTrainingTooltip, hideProductTrainingTooltip} = useProductTrainingContext(tooltipToRender, shouldShowTooltip); diff --git a/src/components/LHNOptionsList/types.ts b/src/components/LHNOptionsList/types.ts index a54908f4c3d3b..7805ea1509d15 100644 --- a/src/components/LHNOptionsList/types.ts +++ b/src/components/LHNOptionsList/types.ts @@ -118,7 +118,7 @@ type OptionRowLHNDataProps = { onLayout?: (event: LayoutChangeEvent) => void; /** Whether to show the educational tooltip for the GBR or RBR */ - shouldShowRBRorGPRTooltip: boolean; + shouldShowRBRorGBRTooltip: boolean; }; type OptionRowLHNProps = { @@ -146,7 +146,7 @@ type OptionRowLHNProps = { onLayout?: (event: LayoutChangeEvent) => void; /** Whether to show the educational tooltip on the GBR or RBR */ - shouldShowRBRorGPRTooltip: boolean; + shouldShowRBRorGBRTooltip: boolean; }; type RenderItemProps = {item: string};