From 8fc14266108caf16386160a52d082cbd98bc0c56 Mon Sep 17 00:00:00 2001 From: BrtqKr Date: Mon, 29 Apr 2024 10:48:38 +0200 Subject: [PATCH] add props spread for not found page --- src/pages/ErrorPage/NotFoundPage.tsx | 8 ++++---- .../workspace/AccessOrNotFoundWrapper.tsx | 20 ++++++++++--------- .../workspace/WorkspaceInviteMessagePage.tsx | 3 +-- src/pages/workspace/WorkspaceInvitePage.tsx | 3 +-- .../WorkspaceProfileCurrencyPage.tsx | 3 +-- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/pages/ErrorPage/NotFoundPage.tsx b/src/pages/ErrorPage/NotFoundPage.tsx index 7d5dd180709a..cfdeab9c51c7 100644 --- a/src/pages/ErrorPage/NotFoundPage.tsx +++ b/src/pages/ErrorPage/NotFoundPage.tsx @@ -5,17 +5,17 @@ import ScreenWrapper from '@components/ScreenWrapper'; type NotFoundPageProps = { onBackButtonPress?: () => void; -} & Pick; +} & FullPageNotFoundViewProps; // eslint-disable-next-line rulesdir/no-negated-variables -function NotFoundPage({onBackButtonPress, subtitleKey, onLinkPress}: NotFoundPageProps) { +function NotFoundPage({onBackButtonPress, ...fullPageNotFoundViewProps}: NotFoundPageProps) { return ( ); diff --git a/src/pages/workspace/AccessOrNotFoundWrapper.tsx b/src/pages/workspace/AccessOrNotFoundWrapper.tsx index c352717f5499..b6b641979319 100644 --- a/src/pages/workspace/AccessOrNotFoundWrapper.tsx +++ b/src/pages/workspace/AccessOrNotFoundWrapper.tsx @@ -43,29 +43,32 @@ type AccessOrNotFoundWrapperProps = AccessOrNotFoundWrapperOnyxProps & { /** The current feature name that the user tries to get access to */ featureName?: PolicyFeatureName; + + /** Props for customizing fallback pages */ + fullPageNotFoundViewProps?: FullPageNotFoundViewProps; } & Pick; -type PageNotFoundFallbackProps = Pick & {shouldShowFullScreenFallback: boolean}; +type PageNotFoundFallbackProps = Pick & {shouldShowFullScreenFallback: boolean}; -function PageNotFoundFallback({policyID, shouldShowFullScreenFallback, subtitleKey, onLinkPress}: PageNotFoundFallbackProps) { +function PageNotFoundFallback({policyID, shouldShowFullScreenFallback, fullPageNotFoundViewProps}: PageNotFoundFallbackProps) { return shouldShowFullScreenFallback ? ( Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)} shouldForceFullScreen - subtitleKey={subtitleKey} - onLinkPress={onLinkPress} + // eslint-disable-next-line react/jsx-props-no-spreading + {...fullPageNotFoundViewProps} /> ) : ( Navigation.goBack(ROUTES.WORKSPACE_PROFILE.getRoute(policyID))} - subtitleKey={subtitleKey} - onLinkPress={onLinkPress} + // eslint-disable-next-line react/jsx-props-no-spreading + {...fullPageNotFoundViewProps} /> ); } -function AccessOrNotFoundWrapper({accessVariants = [], subtitleKey, onLinkPress, ...props}: AccessOrNotFoundWrapperProps) { +function AccessOrNotFoundWrapper({accessVariants = [], fullPageNotFoundViewProps, ...props}: AccessOrNotFoundWrapperProps) { const {policy, policyID, featureName, isLoadingReportData} = props; const isPolicyIDInRoute = !!policyID?.length; @@ -100,8 +103,7 @@ function AccessOrNotFoundWrapper({accessVariants = [], subtitleKey, onLinkPress, ); } diff --git a/src/pages/workspace/WorkspaceInviteMessagePage.tsx b/src/pages/workspace/WorkspaceInviteMessagePage.tsx index 801d7be264cd..2eaa38b865e6 100644 --- a/src/pages/workspace/WorkspaceInviteMessagePage.tsx +++ b/src/pages/workspace/WorkspaceInviteMessagePage.tsx @@ -136,8 +136,7 @@ function WorkspaceInviteMessagePage({