From 809ee8c277f6f241734b8e9d8dd5ddcfcc17879d Mon Sep 17 00:00:00 2001 From: BhuvaneshPatil Date: Thu, 14 Nov 2024 23:44:30 +0530 Subject: [PATCH] add not found page for page accessed through link --- .../categories/ImportCategoriesPage.tsx | 17 ++++++++--- .../workspace/members/ImportMembersPage.tsx | 28 +++++++++++++------ src/pages/workspace/tags/ImportTagsPage.tsx | 20 ++++++++++--- 3 files changed, 49 insertions(+), 16 deletions(-) diff --git a/src/pages/workspace/categories/ImportCategoriesPage.tsx b/src/pages/workspace/categories/ImportCategoriesPage.tsx index 82afe6dfc812..930096d0dd1b 100644 --- a/src/pages/workspace/categories/ImportCategoriesPage.tsx +++ b/src/pages/workspace/categories/ImportCategoriesPage.tsx @@ -5,8 +5,11 @@ import usePolicy from '@hooks/usePolicy'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; import * as PolicyUtils from '@libs/PolicyUtils'; import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; +import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; +import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; +import {isEmptyObject} from '@src/types/utils/EmptyObject'; type ImportCategoriesPageProps = StackScreenProps; @@ -22,10 +25,16 @@ function ImportCategoriesPage({route}: ImportCategoriesPageProps) { } return ( - + + + ); } diff --git a/src/pages/workspace/members/ImportMembersPage.tsx b/src/pages/workspace/members/ImportMembersPage.tsx index 6fff3085b472..34b55be31981 100644 --- a/src/pages/workspace/members/ImportMembersPage.tsx +++ b/src/pages/workspace/members/ImportMembersPage.tsx @@ -2,20 +2,32 @@ import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import ImportSpreedsheet from '@components/ImportSpreadsheet'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; +import * as PolicyUtils from '@libs/PolicyUtils'; +import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; +import withPolicyAndFullscreenLoading from '@pages/workspace/withPolicyAndFullscreenLoading'; +import type {WithPolicyAndFullscreenLoadingProps} from '@pages/workspace/withPolicyAndFullscreenLoading'; +import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; +import {isEmptyObject} from '@src/types/utils/EmptyObject'; -type ImportMembersPageProps = StackScreenProps; +type ImportMembersPageProps = WithPolicyAndFullscreenLoadingProps & StackScreenProps; -function ImportMembersPage({route}: ImportMembersPageProps) { - const policyID = route.params.policyID; +function ImportMembersPage({policy}: ImportMembersPageProps) { + const policyID = policy?.id ?? ''; return ( - + + + ); } -export default ImportMembersPage; +export default withPolicyAndFullscreenLoading(ImportMembersPage); diff --git a/src/pages/workspace/tags/ImportTagsPage.tsx b/src/pages/workspace/tags/ImportTagsPage.tsx index 1bbe22750210..7f5275e8d67b 100644 --- a/src/pages/workspace/tags/ImportTagsPage.tsx +++ b/src/pages/workspace/tags/ImportTagsPage.tsx @@ -1,22 +1,34 @@ import type {StackScreenProps} from '@react-navigation/stack'; import React from 'react'; import ImportSpreedsheet from '@components/ImportSpreadsheet'; +import usePolicy from '@hooks/usePolicy'; import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; +import * as PolicyUtils from '@libs/PolicyUtils'; +import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; +import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; +import {isEmptyObject} from '@src/types/utils/EmptyObject'; type ImportTagsPageProps = StackScreenProps; function ImportTagsPage({route}: ImportTagsPageProps) { const policyID = route.params.policyID; + const policy = usePolicy(policyID); const backTo = route.params.backTo; const isQuickSettingsFlow = !!backTo; return ( - + + + ); }