From 9221a03c30a1eed8f6ee41c94f58d05e7ce7705b Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Wed, 4 Sep 2024 05:59:17 +0300 Subject: [PATCH 01/19] fix overflow name --- 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 ba30ea0062b9..be267a62c9f7 100644 --- a/src/components/AccountSwitcher.tsx +++ b/src/components/AccountSwitcher.tsx @@ -141,7 +141,7 @@ function AccountSwitcher() { {currentUserPersonalDetails?.displayName} From 9c22426f2a5ce245e93fcf0669ae5d7b4bc32b40 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sun, 8 Sep 2024 21:50:27 +0300 Subject: [PATCH 02/19] preserve isloading --- src/libs/actions/Delegate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Delegate.ts b/src/libs/actions/Delegate.ts index 4797506d1a3c..fe94a7cc6fea 100644 --- a/src/libs/actions/Delegate.ts +++ b/src/libs/actions/Delegate.ts @@ -18,7 +18,7 @@ Onyx.connect({ }, }); -const KEYS_TO_PRESERVE_DELEGATE_ACCESS = [ONYXKEYS.NVP_TRY_FOCUS_MODE, ONYXKEYS.PREFERRED_THEME, ONYXKEYS.NVP_PREFERRED_LOCALE, ONYXKEYS.SESSION]; +const KEYS_TO_PRESERVE_DELEGATE_ACCESS = [ONYXKEYS.NVP_TRY_FOCUS_MODE, ONYXKEYS.PREFERRED_THEME, ONYXKEYS.NVP_PREFERRED_LOCALE, ONYXKEYS.SESSION, ONYXKEYS.IS_LOADING_APP]; function connect(email: string) { if (!delegatedAccess?.delegators) { From 7f07f36f9ccbb030a1dccc246e0c939021a75168 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sun, 8 Sep 2024 21:50:48 +0300 Subject: [PATCH 03/19] show loading screen for subscription page --- .../settings/Subscription/SubscriptionSettingsPage.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pages/settings/Subscription/SubscriptionSettingsPage.tsx b/src/pages/settings/Subscription/SubscriptionSettingsPage.tsx index c6112ec19c8d..16fa481b16a6 100644 --- a/src/pages/settings/Subscription/SubscriptionSettingsPage.tsx +++ b/src/pages/settings/Subscription/SubscriptionSettingsPage.tsx @@ -1,5 +1,7 @@ import React, {useEffect} from 'react'; import {View} from 'react-native'; +import {useOnyx} from 'react-native-onyx'; +import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import * as Illustrations from '@components/Icon/Illustrations'; import ScreenWrapper from '@components/ScreenWrapper'; @@ -11,6 +13,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import * as Subscription from '@userActions/Subscription'; +import ONYXKEYS from '@src/ONYXKEYS'; import CardSection from './CardSection/CardSection'; import ReducedFunctionalityMessage from './ReducedFunctionalityMessage'; import SubscriptionDetails from './SubscriptionDetails'; @@ -26,7 +29,11 @@ function SubscriptionSettingsPage() { useEffect(() => { Subscription.openSubscriptionPage(); }, []); + const [isAppLoading] = useOnyx(ONYXKEYS.IS_LOADING_APP); + if (!subscriptionPlan && isAppLoading) { + return ; + } if (!subscriptionPlan) { return ; } From f550dffff55ff8f7efede6a0d2316a9994bb7651 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sun, 8 Sep 2024 21:57:25 +0300 Subject: [PATCH 04/19] disable feedback when cannot switch account --- src/components/AccountSwitcher.tsx | 1 + src/libs/actions/Delegate.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/AccountSwitcher.tsx b/src/components/AccountSwitcher.tsx index be267a62c9f7..705b18dfe673 100644 --- a/src/components/AccountSwitcher.tsx +++ b/src/components/AccountSwitcher.tsx @@ -127,6 +127,7 @@ function AccountSwitcher() { }} ref={buttonRef} interactive={canSwitchAccounts} + pressDimmingValue={canSwitchAccounts ? undefined : 1} wrapperStyle={[styles.flexGrow1, styles.flex1, styles.mnw0, styles.justifyContentCenter]} > diff --git a/src/libs/actions/Delegate.ts b/src/libs/actions/Delegate.ts index fe94a7cc6fea..c3e9fc5d1f4d 100644 --- a/src/libs/actions/Delegate.ts +++ b/src/libs/actions/Delegate.ts @@ -18,7 +18,14 @@ Onyx.connect({ }, }); -const KEYS_TO_PRESERVE_DELEGATE_ACCESS = [ONYXKEYS.NVP_TRY_FOCUS_MODE, ONYXKEYS.PREFERRED_THEME, ONYXKEYS.NVP_PREFERRED_LOCALE, ONYXKEYS.SESSION, ONYXKEYS.IS_LOADING_APP]; +const KEYS_TO_PRESERVE_DELEGATE_ACCESS = [ + ONYXKEYS.NVP_TRY_FOCUS_MODE, + ONYXKEYS.PREFERRED_THEME, + ONYXKEYS.NVP_PREFERRED_LOCALE, + ONYXKEYS.SESSION, + ONYXKEYS.IS_LOADING_APP, + ONYXKEYS.IS_LOADING_REPORT_DATA, +]; function connect(email: string) { if (!delegatedAccess?.delegators) { From 2b746dc90817eb6ba0ba7549a67bc9837df31d3d Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sun, 8 Sep 2024 22:43:33 +0300 Subject: [PATCH 05/19] fix avatar position when upload error --- src/components/AvatarWithImagePicker.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/AvatarWithImagePicker.tsx b/src/components/AvatarWithImagePicker.tsx index 6b9995e77814..29eb819e043a 100644 --- a/src/components/AvatarWithImagePicker.tsx +++ b/src/components/AvatarWithImagePicker.tsx @@ -325,7 +325,7 @@ function AvatarWithImagePicker({ ); return ( - + From ad3bf76e0f3dbe4fab0cf0573502fd4500c49bfd Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sun, 8 Sep 2024 22:43:52 +0300 Subject: [PATCH 06/19] show avatar skeleton when loading --- src/components/AvatarSkeleton.tsx | 13 ++++-- src/pages/settings/Profile/ProfilePage.tsx | 48 ++++++++++++---------- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/src/components/AvatarSkeleton.tsx b/src/components/AvatarSkeleton.tsx index 273143f76098..a88304b15fc3 100644 --- a/src/components/AvatarSkeleton.tsx +++ b/src/components/AvatarSkeleton.tsx @@ -1,17 +1,22 @@ import React from 'react'; import {Circle} from 'react-native-svg'; +import type {ValueOf} from 'type-fest'; +import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; -import variables from '@styles/variables'; +import CONST from '@src/CONST'; import SkeletonViewContentLoader from './SkeletonViewContentLoader'; -function AvatarSkeleton() { +function AvatarSkeleton({size = CONST.AVATAR_SIZE.SMALL}: {size?: ValueOf}) { const theme = useTheme(); - const skeletonCircleRadius = variables.sidebarAvatarSize / 2; + + const StyleUtils = useStyleUtils(); + const avatarSize = StyleUtils.getAvatarSize(size); + const skeletonCircleRadius = avatarSize / 2; return ( diff --git a/src/pages/settings/Profile/ProfilePage.tsx b/src/pages/settings/Profile/ProfilePage.tsx index cc3d93c3db25..57bef1eb9190 100755 --- a/src/pages/settings/Profile/ProfilePage.tsx +++ b/src/pages/settings/Profile/ProfilePage.tsx @@ -2,6 +2,7 @@ import React from 'react'; import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; +import AvatarSkeleton from '@components/AvatarSkeleton'; import AvatarWithImagePicker from '@components/AvatarWithImagePicker'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -34,6 +35,7 @@ import type {TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {LoginList, PrivatePersonalDetails} from '@src/types/onyx'; +import {isEmptyObject} from '@src/types/utils/EmptyObject'; type ProfilePageOnyxProps = { loginList: OnyxEntry; @@ -155,27 +157,31 @@ function ProfilePage({ titleStyles={styles.accountSettingsSectionTitle} > - - Navigation.navigate(ROUTES.PROFILE_AVATAR.getRoute(String(accountID)))} - previewSource={UserUtils.getFullSizeAvatar(avatarURL, accountID)} - originalFileName={currentUserPersonalDetails.originalFileName} - headerTitle={translate('profilePage.profileAvatar')} - fallbackIcon={currentUserPersonalDetails?.fallbackIcon} - editIconStyle={styles.profilePageAvatar} - /> - + {isEmptyObject(currentUserPersonalDetails) || accountID === -1 || !avatarURL ? ( + + ) : ( + + Navigation.navigate(ROUTES.PROFILE_AVATAR.getRoute(String(accountID)))} + previewSource={UserUtils.getFullSizeAvatar(avatarURL, accountID)} + originalFileName={currentUserPersonalDetails.originalFileName} + headerTitle={translate('profilePage.profileAvatar')} + fallbackIcon={currentUserPersonalDetails?.fallbackIcon} + editIconStyle={styles.profilePageAvatar} + /> + + )} {publicOptions.map((detail, index) => ( Date: Sun, 8 Sep 2024 22:44:07 +0300 Subject: [PATCH 07/19] rm IS_LOADING_REPORT_DATA --- src/libs/actions/Delegate.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/libs/actions/Delegate.ts b/src/libs/actions/Delegate.ts index c3e9fc5d1f4d..fe94a7cc6fea 100644 --- a/src/libs/actions/Delegate.ts +++ b/src/libs/actions/Delegate.ts @@ -18,14 +18,7 @@ Onyx.connect({ }, }); -const KEYS_TO_PRESERVE_DELEGATE_ACCESS = [ - ONYXKEYS.NVP_TRY_FOCUS_MODE, - ONYXKEYS.PREFERRED_THEME, - ONYXKEYS.NVP_PREFERRED_LOCALE, - ONYXKEYS.SESSION, - ONYXKEYS.IS_LOADING_APP, - ONYXKEYS.IS_LOADING_REPORT_DATA, -]; +const KEYS_TO_PRESERVE_DELEGATE_ACCESS = [ONYXKEYS.NVP_TRY_FOCUS_MODE, ONYXKEYS.PREFERRED_THEME, ONYXKEYS.NVP_PREFERRED_LOCALE, ONYXKEYS.SESSION, ONYXKEYS.IS_LOADING_APP]; function connect(email: string) { if (!delegatedAccess?.delegators) { From 6ee983f54883ac03d47b5226f9f14eea6b6b0919 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Sun, 8 Sep 2024 22:54:42 +0300 Subject: [PATCH 08/19] reset error when source / avatar id changes --- src/components/AvatarWithImagePicker.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/AvatarWithImagePicker.tsx b/src/components/AvatarWithImagePicker.tsx index 29eb819e043a..738cff48c813 100644 --- a/src/components/AvatarWithImagePicker.tsx +++ b/src/components/AvatarWithImagePicker.tsx @@ -193,6 +193,10 @@ function AvatarWithImagePicker({ setError(null, {}); }, [isFocused]); + useEffect(() => { + setError(null, {}); + }, [source, avatarID]); + /** * Check if the attachment extension is allowed. */ From 0618191576b53ac038e76c3a8bd25af6c3827262 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Mon, 16 Sep 2024 12:01:45 +0300 Subject: [PATCH 09/19] add center style avatar --- src/components/AvatarWithImagePicker.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/AvatarWithImagePicker.tsx b/src/components/AvatarWithImagePicker.tsx index 738cff48c813..011b7f510275 100644 --- a/src/components/AvatarWithImagePicker.tsx +++ b/src/components/AvatarWithImagePicker.tsx @@ -376,7 +376,7 @@ function AvatarWithImagePicker({ accessibilityLabel={translate('avatarWithImagePicker.editImage')} disabled={isAvatarCropModalOpen || (disabled && !enablePreview)} disabledStyle={disabledStyle} - style={[styles.pRelative, avatarStyle]} + style={[styles.pRelative, type === CONST.ICON_TYPE_AVATAR && styles.alignSelfCenter, avatarStyle]} ref={anchorRef} > From ca0e5d48763f001d11e4fafd3502892e2dfffb53 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Mon, 16 Sep 2024 12:13:03 +0300 Subject: [PATCH 10/19] fix #48965 --- .../settings/Security/AddDelegate/SelectDelegateRolePage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx b/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx index e295a9a7ece7..60353b90dfba 100644 --- a/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx +++ b/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx @@ -24,9 +24,9 @@ function SelectDelegateRolePage({route}: SelectDelegateRolePageProps) { const roleOptions = Object.values(CONST.DELEGATE_ROLE).map((role) => ({ value: role, text: translate('delegate.role', role), - keyForList: role, alternateText: translate('delegate.roleDescription', role), isSelected: role === route.params.role, + keyForList: role, })); return ( @@ -41,6 +41,7 @@ function SelectDelegateRolePage({route}: SelectDelegateRolePageProps) { <> From b1365f4b6ee8e26850f2c5cce87ed5d51614fcf7 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Mon, 16 Sep 2024 12:15:07 +0300 Subject: [PATCH 11/19] add fallback avatar. fix #48966 --- src/pages/settings/Security/SecuritySettingsPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/settings/Security/SecuritySettingsPage.tsx b/src/pages/settings/Security/SecuritySettingsPage.tsx index 1de5cb58bf38..07e611b0022c 100644 --- a/src/pages/settings/Security/SecuritySettingsPage.tsx +++ b/src/pages/settings/Security/SecuritySettingsPage.tsx @@ -119,7 +119,7 @@ function SecuritySettingsPage() { description: personalDetail?.displayName ? formattedEmail : '', badgeText: translate('delegate.role', role), avatarID: personalDetail?.accountID ?? -1, - icon: personalDetail?.avatar ?? '', + icon: personalDetail?.avatar ?? FallbackAvatar, iconType: CONST.ICON_TYPE_AVATAR, numberOfLinesDescription: 1, wrapperStyle: [styles.sectionMenuItemTopDescription], From ae039e1f91f2bfd3c8676d247d234eae607e42b9 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Mon, 16 Sep 2024 12:25:12 +0300 Subject: [PATCH 12/19] fix #48967 show no results found --- src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx b/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx index eae54fa88c2a..ade900f365a7 100644 --- a/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx +++ b/src/pages/settings/Security/AddDelegate/AddDelegatePage.tsx @@ -48,7 +48,7 @@ function useOptions() { 0, ); - const headerMessage = OptionsListUtils.getHeaderMessage((recentReports?.length || 0) + (personalDetails?.length || 0) !== 0 || !!currentUserOption, !!userToInvite, ''); + const headerMessage = OptionsListUtils.getHeaderMessage((recentReports?.length || 0) + (personalDetails?.length || 0) !== 0, !!userToInvite, ''); if (isLoading) { setIsLoading(false); @@ -72,7 +72,7 @@ function useOptions() { maxRecentReportsToShow: CONST.IOU.MAX_RECENT_REPORTS_TO_SHOW, }); const headerMessage = OptionsListUtils.getHeaderMessage( - (filteredOptions.recentReports?.length || 0) + (filteredOptions.personalDetails?.length || 0) !== 0 || !!filteredOptions.currentUserOption, + (filteredOptions.recentReports?.length || 0) + (filteredOptions.personalDetails?.length || 0) !== 0, !!filteredOptions.userToInvite, debouncedSearchValue, ); From 412544c13e544cdc9d982b6eec07c962f31817c2 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Mon, 16 Sep 2024 12:33:20 +0300 Subject: [PATCH 13/19] fix #48972 --- src/pages/settings/Security/SecuritySettingsPage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/settings/Security/SecuritySettingsPage.tsx b/src/pages/settings/Security/SecuritySettingsPage.tsx index 07e611b0022c..6403b0ac64e2 100644 --- a/src/pages/settings/Security/SecuritySettingsPage.tsx +++ b/src/pages/settings/Security/SecuritySettingsPage.tsx @@ -163,7 +163,7 @@ function SecuritySettingsPage() {
( - + {translate('delegate.copilotDelegatedAccessDescription')} {translate('common.learnMore')} - + )} isCentralPane subtitleMuted From cdbf52f0e89dc0b910aa362697a97dc61d1d5f4f Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Mon, 16 Sep 2024 19:29:11 +0300 Subject: [PATCH 14/19] fix center avatar on center --- src/pages/settings/Profile/ProfilePage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/settings/Profile/ProfilePage.tsx b/src/pages/settings/Profile/ProfilePage.tsx index 57bef1eb9190..c7a585b724ef 100755 --- a/src/pages/settings/Profile/ProfilePage.tsx +++ b/src/pages/settings/Profile/ProfilePage.tsx @@ -168,7 +168,7 @@ function ProfilePage({ onImageSelected={PersonalDetails.updateAvatar} onImageRemoved={PersonalDetails.deleteAvatar} size={CONST.AVATAR_SIZE.XLARGE} - avatarStyle={styles.avatarXLarge} + avatarStyle={[styles.avatarXLarge, styles.alignSelfStart]} pendingAction={currentUserPersonalDetails?.pendingFields?.avatar ?? undefined} errors={currentUserPersonalDetails?.errorFields?.avatar ?? null} errorRowStyles={styles.mt6} From 186dfde697f28f23f0d6460f5697945d207af506 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Mon, 16 Sep 2024 20:22:49 +0300 Subject: [PATCH 15/19] Update src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx Co-authored-by: Gandalf --- .../settings/Security/AddDelegate/SelectDelegateRolePage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx b/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx index 60353b90dfba..121b2a6e1c4f 100644 --- a/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx +++ b/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx @@ -41,7 +41,7 @@ function SelectDelegateRolePage({route}: SelectDelegateRolePageProps) { role.value === route.params.role)?.value} headerContent={ <> From 81e49dd5f2ca02301c2ab729dd108fbc4088284a Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Mon, 16 Sep 2024 21:05:14 +0300 Subject: [PATCH 16/19] undo --- .../settings/Security/AddDelegate/SelectDelegateRolePage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx b/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx index 121b2a6e1c4f..60353b90dfba 100644 --- a/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx +++ b/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx @@ -41,7 +41,7 @@ function SelectDelegateRolePage({route}: SelectDelegateRolePageProps) { role.value === route.params.role)?.value} + initiallyFocusedOptionKey={route.params.role} headerContent={ <> From ef398851d6f29097ba1e0432a47eec34773d5775 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Mon, 16 Sep 2024 21:20:53 +0300 Subject: [PATCH 17/19] migrate to useOnyx --- src/pages/settings/Profile/ProfilePage.tsx | 58 ++++------------------ 1 file changed, 10 insertions(+), 48 deletions(-) diff --git a/src/pages/settings/Profile/ProfilePage.tsx b/src/pages/settings/Profile/ProfilePage.tsx index c7a585b724ef..83fcdefb3529 100755 --- a/src/pages/settings/Profile/ProfilePage.tsx +++ b/src/pages/settings/Profile/ProfilePage.tsx @@ -1,7 +1,6 @@ import React from 'react'; import {View} from 'react-native'; -import type {OnyxEntry} from 'react-native-onyx'; -import {withOnyx} from 'react-native-onyx'; +import {useOnyx} from 'react-native-onyx'; import AvatarSkeleton from '@components/AvatarSkeleton'; import AvatarWithImagePicker from '@components/AvatarWithImagePicker'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; @@ -17,8 +16,7 @@ import ScrollView from '@components/ScrollView'; import Section from '@components/Section'; import Text from '@components/Text'; import Tooltip from '@components/Tooltip'; -import type {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentUserPersonalDetails'; -import withCurrentUserPersonalDetails from '@components/withCurrentUserPersonalDetails'; +import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useStyleUtils from '@hooks/useStyleUtils'; @@ -34,45 +32,21 @@ import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import type {LoginList, PrivatePersonalDetails} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -type ProfilePageOnyxProps = { - loginList: OnyxEntry; - /** User's private personal details */ - privatePersonalDetails: OnyxEntry; - /** Whether app is loading */ - isLoadingApp: OnyxEntry; -}; - -type ProfilePageProps = ProfilePageOnyxProps & WithCurrentUserPersonalDetailsProps; - -function ProfilePage({ - loginList, - privatePersonalDetails = { - legalFirstName: '', - legalLastName: '', - dob: '', - addresses: [ - { - street: '', - street2: '', - city: '', - state: '', - zip: '', - country: '', - }, - ], - }, - currentUserPersonalDetails, - isLoadingApp, -}: ProfilePageProps) { +function ProfilePage() { const theme = useTheme(); const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); const {translate} = useLocalize(); const {shouldUseNarrowLayout} = useResponsiveLayout(); + const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST); + const [privatePersonalDetails] = useOnyx(ONYXKEYS.PRIVATE_PERSONAL_DETAILS); + const currentUserPersonalDetails = useCurrentUserPersonalDetails(); + + const isLoadingApp = useOnyx(ONYXKEYS.IS_LOADING_APP); + const getPronouns = (): string => { const pronounsKey = currentUserPersonalDetails?.pronouns?.replace(CONST.PRONOUNS.PREFIX, '') ?? ''; return pronounsKey ? translate(`pronouns.${pronounsKey}` as TranslationPaths) : translate('profilePage.selectYourPronouns'); @@ -250,16 +224,4 @@ function ProfilePage({ ProfilePage.displayName = 'ProfilePage'; -export default withCurrentUserPersonalDetails( - withOnyx({ - loginList: { - key: ONYXKEYS.LOGIN_LIST, - }, - privatePersonalDetails: { - key: ONYXKEYS.PRIVATE_PERSONAL_DETAILS, - }, - isLoadingApp: { - key: ONYXKEYS.IS_LOADING_APP, - }, - })(ProfilePage), -); +export default ProfilePage; From ef72f6e8f30fb1e1c780b1a0cf1709b71da0302a Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Mon, 16 Sep 2024 22:30:18 +0300 Subject: [PATCH 18/19] Update src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx Co-authored-by: Gandalf --- .../settings/Security/AddDelegate/SelectDelegateRolePage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx b/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx index 60353b90dfba..4ecc4916c358 100644 --- a/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx +++ b/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx @@ -41,7 +41,8 @@ function SelectDelegateRolePage({route}: SelectDelegateRolePageProps) { role.isSelected)?.keyForList} + shouldUpdateFocusedIndex={true} headerContent={ <> From 747372d480adc07403d1c8e7200fae9c2e369558 Mon Sep 17 00:00:00 2001 From: Rushat Gabhane Date: Mon, 16 Sep 2024 22:31:44 +0300 Subject: [PATCH 19/19] fix lint --- .../settings/Security/AddDelegate/SelectDelegateRolePage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx b/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx index 4ecc4916c358..551f5c2c223c 100644 --- a/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx +++ b/src/pages/settings/Security/AddDelegate/SelectDelegateRolePage.tsx @@ -42,7 +42,7 @@ function SelectDelegateRolePage({route}: SelectDelegateRolePageProps) { isAlternateTextMultilineSupported alternateTextNumberOfLines={4} initiallyFocusedOptionKey={roleOptions.find((role) => role.isSelected)?.keyForList} - shouldUpdateFocusedIndex={true} + shouldUpdateFocusedIndex headerContent={ <>