diff --git a/src/pages/workspace/AdminPolicyAccessOrNotFoundWrapper.tsx b/src/pages/workspace/AdminPolicyAccessOrNotFoundWrapper.tsx index 1fc4b51aca21..207c277a65d1 100644 --- a/src/pages/workspace/AdminPolicyAccessOrNotFoundWrapper.tsx +++ b/src/pages/workspace/AdminPolicyAccessOrNotFoundWrapper.tsx @@ -9,6 +9,7 @@ import Navigation from '@libs/Navigation/Navigation'; import * as PolicyUtils from '@libs/PolicyUtils'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import * as Policy from '@userActions/Policy'; +import type {TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type * as OnyxTypes from '@src/types/onyx'; @@ -28,6 +29,12 @@ type AdminPolicyAccessOrNotFoundComponentProps = AdminAccessOrNotFoundOnyxProps /** The report currently being looked at */ policyID: string; + + /** Function to call when pressing the navigation link */ + onLinkPress?: () => void; + + /** The key in the translations file to use for the subtitle */ + subtitleKey?: TranslationPaths; }; function AdminPolicyAccessOrNotFoundComponent(props: AdminPolicyAccessOrNotFoundComponentProps) { @@ -45,7 +52,7 @@ function AdminPolicyAccessOrNotFoundComponent(props: AdminPolicyAccessOrNotFound const shouldShowFullScreenLoadingIndicator = props.isLoadingReportData !== false && (!Object.entries(props.policy ?? {}).length || !props.policy?.id); - const shouldShowNotFoundPage = isEmptyObject(props.policy) || !props.policy?.id || !PolicyUtils.isPolicyAdmin(props.policy); + const shouldShowNotFoundPage = isEmptyObject(props.policy) || !props.policy?.id || !PolicyUtils.isPolicyAdmin(props.policy) || PolicyUtils.isPendingDeletePolicy(props.policy); if (shouldShowFullScreenLoadingIndicator) { return ; @@ -61,6 +68,8 @@ function AdminPolicyAccessOrNotFoundComponent(props: AdminPolicyAccessOrNotFound shouldShow shouldForceFullScreen onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)} + onLinkPress={props.onLinkPress} + subtitleKey={props.subtitleKey} /> ); diff --git a/src/pages/workspace/WorkspaceInviteMessagePage.tsx b/src/pages/workspace/WorkspaceInviteMessagePage.tsx index ff606e26e707..84ee1e1bf70f 100644 --- a/src/pages/workspace/WorkspaceInviteMessagePage.tsx +++ b/src/pages/workspace/WorkspaceInviteMessagePage.tsx @@ -6,7 +6,6 @@ import {Keyboard, View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; import type {GestureResponderEvent} from 'react-native/Libraries/Types/CoreEventTypes'; -import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import FormProvider from '@components/Form/FormProvider'; import InputWrapper from '@components/Form/InputWrapper'; import type {FormInputErrors} from '@components/Form/types'; @@ -37,6 +36,7 @@ import type SCREENS from '@src/SCREENS'; import INPUT_IDS from '@src/types/form/WorkspaceInviteMessageForm'; import type {InvitedEmailsToAccountIDs, PersonalDetailsList} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; +import AdminPolicyAccessOrNotFoundWrapper from './AdminPolicyAccessOrNotFoundWrapper'; import SearchInputManager from './SearchInputManager'; import withPolicyAndFullscreenLoading from './withPolicyAndFullscreenLoading'; import type {WithPolicyAndFullscreenLoadingProps} from './withPolicyAndFullscreenLoading'; @@ -133,15 +133,14 @@ function WorkspaceInviteMessagePage({ const policyName = policy?.name; return ( - - - - + + ); } diff --git a/src/pages/workspace/WorkspaceInvitePage.tsx b/src/pages/workspace/WorkspaceInvitePage.tsx index 0a9c8cd71894..08799d4bf5ac 100644 --- a/src/pages/workspace/WorkspaceInvitePage.tsx +++ b/src/pages/workspace/WorkspaceInvitePage.tsx @@ -3,7 +3,6 @@ import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import type {SectionListData} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; -import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import FormAlertWithSubmitButton from '@components/FormAlertWithSubmitButton'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import {useOptionsList} from '@components/OptionListContextProvider'; @@ -33,6 +32,7 @@ import type SCREENS from '@src/SCREENS'; import type {Beta, InvitedEmailsToAccountIDs} from '@src/types/onyx'; import type {Errors} from '@src/types/onyx/OnyxCommon'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; +import AdminPolicyAccessOrNotFoundWrapper from './AdminPolicyAccessOrNotFoundWrapper'; import SearchInputManager from './SearchInputManager'; import withPolicyAndFullscreenLoading from './withPolicyAndFullscreenLoading'; import type {WithPolicyAndFullscreenLoadingProps} from './withPolicyAndFullscreenLoading'; @@ -52,7 +52,7 @@ type WorkspaceInvitePageProps = WithPolicyAndFullscreenLoadingProps & WorkspaceInvitePageOnyxProps & StackScreenProps; -function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, policy, isLoadingReportData = true}: WorkspaceInvitePageProps) { +function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, policy}: WorkspaceInvitePageProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); const [searchTerm, setSearchTerm] = useState(''); @@ -280,18 +280,17 @@ function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, poli ); return ( - setDidScreenTransitionEnd(true)} + - setDidScreenTransitionEnd(true)} > - - + + ); } diff --git a/src/pages/workspace/WorkspaceNamePage.tsx b/src/pages/workspace/WorkspaceNamePage.tsx index dc2f8ebb4560..96c045332271 100644 --- a/src/pages/workspace/WorkspaceNamePage.tsx +++ b/src/pages/workspace/WorkspaceNamePage.tsx @@ -15,6 +15,7 @@ import * as Policy from '@userActions/Policy'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import INPUT_IDS from '@src/types/form/WorkspaceSettingsForm'; +import AdminPolicyAccessOrNotFoundWrapper from './AdminPolicyAccessOrNotFoundWrapper'; import withPolicy from './withPolicy'; import type {WithPolicyProps} from './withPolicy'; @@ -53,39 +54,41 @@ function WorkspaceNamePage({policy}: Props) { }, []); return ( - - Navigation.goBack()} - /> - - + - - - - - + Navigation.goBack()} + /> + + + + + + + + ); } diff --git a/src/pages/workspace/WorkspaceProfileCurrencyPage.tsx b/src/pages/workspace/WorkspaceProfileCurrencyPage.tsx index c8640d3f71b0..20ffe410a196 100644 --- a/src/pages/workspace/WorkspaceProfileCurrencyPage.tsx +++ b/src/pages/workspace/WorkspaceProfileCurrencyPage.tsx @@ -1,7 +1,6 @@ import React, {useState} from 'react'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; -import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; import SelectionList from '@components/SelectionList'; @@ -13,6 +12,7 @@ import * as Policy from '@userActions/Policy'; import ONYXKEYS from '@src/ONYXKEYS'; import type {CurrencyList} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; +import AdminPolicyAccessOrNotFoundWrapper from './AdminPolicyAccessOrNotFoundWrapper'; import type {WithPolicyAndFullscreenLoadingProps} from './withPolicyAndFullscreenLoading'; import withPolicyAndFullscreenLoading from './withPolicyAndFullscreenLoading'; @@ -31,7 +31,7 @@ type WorkspaceProfileCurrencyPageSectionItem = { const getDisplayText = (currencyCode: string, currencySymbol: string) => `${currencyCode} - ${currencySymbol}`; -function WorkspaceProfileCurrencyPage({currencyList = {}, policy, isLoadingReportData = true}: WorkspaceProfileCurrentPageProps) { +function WorkspaceProfileCurrencyPage({currencyList = {}, policy}: WorkspaceProfileCurrentPageProps) { const {translate} = useLocalize(); const [searchText, setSearchText] = useState(''); const trimmedText = searchText.trim().toLowerCase(); @@ -71,15 +71,14 @@ function WorkspaceProfileCurrencyPage({currencyList = {}, policy, isLoadingRepor }; return ( - - - - + + ); } diff --git a/src/pages/workspace/WorkspaceProfileDescriptionPage.tsx b/src/pages/workspace/WorkspaceProfileDescriptionPage.tsx index 7787be42de71..865406326e2e 100644 --- a/src/pages/workspace/WorkspaceProfileDescriptionPage.tsx +++ b/src/pages/workspace/WorkspaceProfileDescriptionPage.tsx @@ -17,6 +17,7 @@ import variables from '@styles/variables'; import * as Policy from '@userActions/Policy'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; +import AdminPolicyAccessOrNotFoundWrapper from './AdminPolicyAccessOrNotFoundWrapper'; import withPolicy from './withPolicy'; import type {WithPolicyProps} from './withPolicy'; @@ -68,47 +69,49 @@ function WorkspaceProfileDescriptionPage({policy}: Props) { ); return ( - - Navigation.goBack()} - /> - - + - - { - updateMultilineInputRange(el); - }} - /> - - - + Navigation.goBack()} + /> + + + + { + updateMultilineInputRange(el); + }} + /> + + + + ); } diff --git a/src/pages/workspace/WorkspaceProfileSharePage.tsx b/src/pages/workspace/WorkspaceProfileSharePage.tsx index 73f24af7c325..5aab39f8e019 100644 --- a/src/pages/workspace/WorkspaceProfileSharePage.tsx +++ b/src/pages/workspace/WorkspaceProfileSharePage.tsx @@ -19,6 +19,7 @@ import Navigation from '@libs/Navigation/Navigation'; import * as Url from '@libs/Url'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; +import AdminPolicyAccessOrNotFoundWrapper from './AdminPolicyAccessOrNotFoundWrapper'; import withPolicy from './withPolicy'; import type {WithPolicyProps} from './withPolicy'; @@ -38,49 +39,51 @@ function WorkspaceProfileSharePage({policy}: WithPolicyProps) { const url = `${urlWithTrailingSlash}${ROUTES.WORKSPACE_JOIN_USER.getRoute(id, adminEmail)}`; return ( - - - - - - {/* + + + + + + + {/* Right now QR code download button is not shown anymore This is a temporary measure because right now it's broken because of the Fabric update. We need to wait for react-native v0.74 to be released so react-native-view-shot gets fixed. Please see https://github.com/Expensify/App/issues/40110 to see if it can be re-enabled. */} - - + + - - Clipboard.setString(url)} - shouldLimitWidth={false} - wrapperStyle={themeStyles.sectionMenuItemTopDescription} - /> + + Clipboard.setString(url)} + shouldLimitWidth={false} + wrapperStyle={themeStyles.sectionMenuItemTopDescription} + /> + - - - + + + ); }