From 89ef7e34bda317299b4c696f1b461335e4a49af6 Mon Sep 17 00:00:00 2001 From: c3024 Date: Wed, 18 Oct 2023 08:44:26 +0530 Subject: [PATCH] show loading indicator when policy loading --- src/pages/workspace/WorkspaceInvitePage.js | 7 ++++--- src/pages/workspace/WorkspaceMembersPage.js | 7 ++++--- src/pages/workspace/WorkspaceSettingsCurrencyPage.js | 11 +++++++---- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/pages/workspace/WorkspaceInvitePage.js b/src/pages/workspace/WorkspaceInvitePage.js index 3a47ed0c95f4..febb430aed32 100644 --- a/src/pages/workspace/WorkspaceInvitePage.js +++ b/src/pages/workspace/WorkspaceInvitePage.js @@ -14,7 +14,7 @@ import * as Policy from '../../libs/actions/Policy'; import FormAlertWithSubmitButton from '../../components/FormAlertWithSubmitButton'; import * as OptionsListUtils from '../../libs/OptionsListUtils'; import CONST from '../../CONST'; -import withPolicy, {policyDefaultProps, policyPropTypes} from './withPolicy'; +import {policyDefaultProps, policyPropTypes} from './withPolicy'; import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView'; import ROUTES from '../../ROUTES'; import * as PolicyUtils from '../../libs/PolicyUtils'; @@ -22,6 +22,7 @@ import * as Browser from '../../libs/Browser'; import useNetwork from '../../hooks/useNetwork'; import useLocalize from '../../hooks/useLocalize'; import SelectionList from '../../components/SelectionList'; +import withPolicyAndFullscreenLoading from './withPolicyAndFullscreenLoading'; const personalDetailsPropTypes = PropTypes.shape({ /** The login of the person (either email or phone number) */ @@ -247,7 +248,7 @@ function WorkspaceInvitePage(props) { return ( Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)} > @@ -298,7 +299,7 @@ WorkspaceInvitePage.defaultProps = defaultProps; WorkspaceInvitePage.displayName = 'WorkspaceInvitePage'; export default compose( - withPolicy, + withPolicyAndFullscreenLoading, withOnyx({ personalDetails: { key: ONYXKEYS.PERSONAL_DETAILS_LIST, diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js index e6cf8315d714..859064444b2c 100644 --- a/src/pages/workspace/WorkspaceMembersPage.js +++ b/src/pages/workspace/WorkspaceMembersPage.js @@ -18,7 +18,7 @@ import ROUTES from '../../ROUTES'; import ConfirmModal from '../../components/ConfirmModal'; import personalDetailsPropType from '../personalDetailsPropType'; import withWindowDimensions, {windowDimensionsPropTypes} from '../../components/withWindowDimensions'; -import withPolicy, {policyDefaultProps, policyPropTypes} from './withPolicy'; +import {policyDefaultProps, policyPropTypes} from './withPolicy'; import CONST from '../../CONST'; import {withNetwork} from '../../components/OnyxProvider'; import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView'; @@ -32,6 +32,7 @@ import * as PersonalDetailsUtils from '../../libs/PersonalDetailsUtils'; import SelectionList from '../../components/SelectionList'; import Text from '../../components/Text'; import * as Browser from '../../libs/Browser'; +import withPolicyAndFullscreenLoading from './withPolicyAndFullscreenLoading'; const propTypes = { /** All personal details asssociated with user */ @@ -389,7 +390,7 @@ function WorkspaceMembersPage(props) { testID={WorkspaceMembersPage.displayName} > Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)} > @@ -468,7 +469,7 @@ WorkspaceMembersPage.displayName = 'WorkspaceMembersPage'; export default compose( withLocalize, withWindowDimensions, - withPolicy, + withPolicyAndFullscreenLoading, withNetwork(), withOnyx({ personalDetails: { diff --git a/src/pages/workspace/WorkspaceSettingsCurrencyPage.js b/src/pages/workspace/WorkspaceSettingsCurrencyPage.js index 9c757b730cef..a8f473bb1a0b 100644 --- a/src/pages/workspace/WorkspaceSettingsCurrencyPage.js +++ b/src/pages/workspace/WorkspaceSettingsCurrencyPage.js @@ -10,10 +10,11 @@ import Navigation from '../../libs/Navigation/Navigation'; import ROUTES from '../../ROUTES'; import compose from '../../libs/compose'; import ONYXKEYS from '../../ONYXKEYS'; -import withPolicy, {policyDefaultProps, policyPropTypes} from './withPolicy'; +import {policyDefaultProps, policyPropTypes} from './withPolicy'; import * as Policy from '../../libs/actions/Policy'; import * as PolicyUtils from '../../libs/PolicyUtils'; import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView'; +import withPolicyAndFullscreenLoading from './withPolicyAndFullscreenLoading'; const propTypes = { /** Constant, list of available currencies */ @@ -23,17 +24,19 @@ const propTypes = { symbol: PropTypes.string.isRequired, }), ), + isLoadingReportData: PropTypes.bool, ...policyPropTypes, }; const defaultProps = { currencyList: {}, + isLoadingReportData: true, ...policyDefaultProps, }; const getDisplayText = (currencyCode, currencySymbol) => `${currencyCode} - ${currencySymbol}`; -function WorkspaceSettingsCurrencyPage({currencyList, policy}) { +function WorkspaceSettingsCurrencyPage({currencyList, policy, isLoadingReportData}) { const {translate} = useLocalize(); const [searchText, setSearchText] = useState(''); const trimmedText = searchText.trim().toLowerCase(); @@ -79,7 +82,7 @@ function WorkspaceSettingsCurrencyPage({currencyList, policy}) { > Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)} - shouldShow={_.isEmpty(policy) || !PolicyUtils.isPolicyAdmin(policy) || PolicyUtils.isPendingDeletePolicy(policy)} + shouldShow={(_.isEmpty(policy) && !isLoadingReportData) || !PolicyUtils.isPolicyAdmin(policy) || PolicyUtils.isPendingDeletePolicy(policy)} subtitleKey={_.isEmpty(policy) ? undefined : 'workspace.common.notAuthorized'} >