From bec5c64a583734208c6ad4946d6534ddc6d596fa Mon Sep 17 00:00:00 2001 From: Marc Glasser Date: Wed, 22 Sep 2021 18:50:55 -1000 Subject: [PATCH] Add spinner --- src/pages/workspace/WorkspaceSidebar.js | 29 +++++-------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/src/pages/workspace/WorkspaceSidebar.js b/src/pages/workspace/WorkspaceSidebar.js index ad5c99d86e88..869bdde41e1e 100644 --- a/src/pages/workspace/WorkspaceSidebar.js +++ b/src/pages/workspace/WorkspaceSidebar.js @@ -23,12 +23,11 @@ import themedefault from '../../styles/themes/default'; import HeaderWithCloseButton from '../../components/HeaderWithCloseButton'; import withWindowDimensions, {windowDimensionsPropTypes} from '../../components/withWindowDimensions'; import compose from '../../libs/compose'; -import Growl from '../../libs/Growl'; import ONYXKEYS from '../../ONYXKEYS'; import Avatar from '../../components/Avatar'; -import CONST from '../../CONST'; import Tooltip from '../../components/Tooltip'; import variables from '../../styles/variables'; +import FullScreenLoadingIndicator from '../../components/FullscreenLoadingIndicator'; const propTypes = { /** Whether the current screen is focused. */ @@ -43,24 +42,21 @@ const propTypes = { name: PropTypes.string, }), - /** All the polices that we have loaded in Onyx */ - allPolicies: PropTypes.shape({ - /** ID of the policy */ - id: PropTypes.string, - }), - ...withLocalizePropTypes, ...windowDimensionsPropTypes, }; const defaultProps = { policy: {}, - allPolicies: null, }; const WorkspaceSidebar = ({ - translate, isSmallScreenWidth, policy, allPolicies, isFocused, + translate, isSmallScreenWidth, policy, isFocused, }) => { + if (_.isEmpty(policy)) { + return ; + } + const menuItems = [ { translationKey: 'workspace.common.card', @@ -80,16 +76,6 @@ const WorkspaceSidebar = ({ }, ]; - // After all the policies have loaded, we can know if the given policyID points to a nonexistant workspace - // When free plan is out of beta and Permissions.canUseFreePlan() gets removed, - // all code involving 'allPolicies' can be removed since policy loading will no longer be delayed on login. - if (allPolicies !== null && _.isEmpty(policy)) { - Growl.error(translate('workspace.error.growlMessageInvalidPolicy'), CONST.GROWL.DURATION_LONG); - Navigation.dismissModal(); - return null; - } - - const openEditor = () => Navigation.navigate(ROUTES.getWorkspaceEditorRoute(policy.id)); return ( @@ -204,8 +190,5 @@ export default compose( return `${ONYXKEYS.COLLECTION.POLICY}${policyID}`; }, }, - allPolicies: { - key: ONYXKEYS.COLLECTION.POLICY, - }, }), )(WorkspaceSidebar);