Skip to content

Commit

Permalink
integrate AccessOrNotFoundWrapper into WorkspaceInvoicesPage
Browse files Browse the repository at this point in the history
  • Loading branch information
rezkiy37 committed Sep 27, 2024
1 parent 70ed492 commit 82e9ab2
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions src/pages/workspace/invoices/WorkspaceInvoicesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import type {FullScreenNavigatorParamList} from '@navigation/types';
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';
import WorkspacePageWithSections from '@pages/workspace/WorkspacePageWithSections';
import CONST from '@src/CONST';
import type SCREENS from '@src/SCREENS';
Expand All @@ -18,21 +19,27 @@ function WorkspaceInvoicesPage({route}: WorkspaceInvoicesPageProps) {
const styles = useThemeStyles();
const {shouldUseNarrowLayout} = useResponsiveLayout();
return (
<WorkspacePageWithSections
shouldUseScrollView
headerText={translate('workspace.common.invoices')}
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_INVOICES}
shouldShowOfflineIndicatorInWideScreen
shouldSkipVBBACall={false}
route={route}
<AccessOrNotFoundWrapper
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]}
policyID={route.params.policyID}
featureName={CONST.POLICY.MORE_FEATURES.ARE_INVOICES_ENABLED}
>
{(hasVBA?: boolean, policyID?: string) => (
<View style={[styles.mt3, shouldUseNarrowLayout ? styles.workspaceSectionMobile : styles.workspaceSection]}>
{!hasVBA && policyID && <WorkspaceInvoicesNoVBAView policyID={policyID} />}
{hasVBA && policyID && <WorkspaceInvoicesVBAView policyID={policyID} />}
</View>
)}
</WorkspacePageWithSections>
<WorkspacePageWithSections
shouldUseScrollView
headerText={translate('workspace.common.invoices')}
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_INVOICES}
shouldShowOfflineIndicatorInWideScreen
shouldSkipVBBACall={false}
route={route}
>
{(hasVBA?: boolean, policyID?: string) => (
<View style={[styles.mt3, shouldUseNarrowLayout ? styles.workspaceSectionMobile : styles.workspaceSection]}>
{!hasVBA && policyID && <WorkspaceInvoicesNoVBAView policyID={policyID} />}
{hasVBA && policyID && <WorkspaceInvoicesVBAView policyID={policyID} />}
</View>
)}
</WorkspacePageWithSections>
</AccessOrNotFoundWrapper>
);
}

Expand Down

0 comments on commit 82e9ab2

Please sign in to comment.