Skip to content

Commit

Permalink
replace removed component wrapper with AccessOrNotFoundWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
cdOut committed Apr 30, 2024
1 parent fc2c186 commit db5a4e9
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 59 deletions.
68 changes: 33 additions & 35 deletions src/pages/workspace/accounting/xero/XeroImportPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import ScrollView from '@components/ScrollView';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import AdminPolicyAccessOrNotFoundWrapper from '@pages/workspace/AdminPolicyAccessOrNotFoundWrapper';
import FeatureEnabledAccessOrNotFoundWrapper from '@pages/workspace/FeatureEnabledAccessOrNotFoundWrapper';
import withPolicy from '@pages/workspace/withPolicy';
import type {WithPolicyProps} from '@pages/workspace/withPolicy';
import CONST from '@src/CONST';
import type {Tenant} from '@src/types/onyx/Policy';
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';

function XeroImportPage({policy}: WithPolicyProps) {
const {translate} = useLocalize();
Expand Down Expand Up @@ -72,40 +71,39 @@ function XeroImportPage({policy}: WithPolicyProps) {
);

return (
<AdminPolicyAccessOrNotFoundWrapper policyID={policyID}>
<FeatureEnabledAccessOrNotFoundWrapper
policyID={policyID}
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED}
<AccessOrNotFoundWrapper
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]}
policyID={policyID}
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED}
>
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
shouldEnableMaxHeight
testID={XeroImportPage.displayName}
>
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
shouldEnableMaxHeight
testID={XeroImportPage.displayName}
>
<HeaderWithBackButton
title={translate('workspace.accounting.import')}
subtitle={currentXeroOrganization?.name}
/>
<ScrollView contentContainerStyle={styles.pb2}>
<Text style={[styles.ph5, styles.pb5]}>{translate('workspace.xero.importDescription')}</Text>
{sections.map((section) => (
<OfflineWithFeedback
key={section.description}
pendingAction={section.pendingAction}
>
<MenuItemWithTopDescription
title={section.title}
description={section.description}
shouldShowRightIcon
onPress={section.action}
brickRoadIndicator={section.hasError ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
/>
</OfflineWithFeedback>
))}
</ScrollView>
</ScreenWrapper>
</FeatureEnabledAccessOrNotFoundWrapper>
</AdminPolicyAccessOrNotFoundWrapper>
<HeaderWithBackButton
title={translate('workspace.accounting.import')}
subtitle={currentXeroOrganization?.name}
/>
<ScrollView contentContainerStyle={styles.pb2}>
<Text style={[styles.ph5, styles.pb5]}>{translate('workspace.xero.importDescription')}</Text>
{sections.map((section) => (
<OfflineWithFeedback
key={section.description}
pendingAction={section.pendingAction}
>
<MenuItemWithTopDescription
title={section.title}
description={section.description}
shouldShowRightIcon
onPress={section.action}
brickRoadIndicator={section.hasError ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
/>
</OfflineWithFeedback>
))}
</ScrollView>
</ScreenWrapper>
</AccessOrNotFoundWrapper>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import {updatePolicyConnectionConfig} from '@libs/actions/connections';
import type {SettingsNavigatorParamList} from '@libs/Navigation/types';
import AdminPolicyAccessOrNotFoundWrapper from '@pages/workspace/AdminPolicyAccessOrNotFoundWrapper';
import FeatureEnabledAccessOrNotFoundWrapper from '@pages/workspace/FeatureEnabledAccessOrNotFoundWrapper';
import withPolicy from '@pages/workspace/withPolicy';
import type {WithPolicyProps} from '@pages/workspace/withPolicy';
import CONST from '@src/CONST';
import type SCREENS from '@src/SCREENS';
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';

type XeroOrganizationConfigurationPageProps = WithPolicyProps & StackScreenProps<SettingsNavigatorParamList, typeof SCREENS.WORKSPACE.ACCOUNTING.XERO_ORGANIZATION>;
function XeroOrganizationConfigurationPage({
Expand Down Expand Up @@ -46,29 +45,28 @@ function XeroOrganizationConfigurationPage({
};

return (
<AdminPolicyAccessOrNotFoundWrapper policyID={policyID}>
<FeatureEnabledAccessOrNotFoundWrapper
policyID={policyID}
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED}
<AccessOrNotFoundWrapper
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]}
policyID={policyID}
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED}
>
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
shouldEnableMaxHeight
testID={XeroOrganizationConfigurationPage.displayName}
>
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
shouldEnableMaxHeight
testID={XeroOrganizationConfigurationPage.displayName}
>
<HeaderWithBackButton title={translate('workspace.xero.organization')} />
<ScrollView contentContainerStyle={styles.pb2}>
<Text style={[styles.ph5, styles.pb5]}>{translate('workspace.xero.organizationDescription')}</Text>
<SelectionList
ListItem={RadioListItem}
onSelectRow={saveSelection}
sections={[{data: sections}]}
initiallyFocusedOptionKey={organizationID}
/>
</ScrollView>
</ScreenWrapper>
</FeatureEnabledAccessOrNotFoundWrapper>
</AdminPolicyAccessOrNotFoundWrapper>
<HeaderWithBackButton title={translate('workspace.xero.organization')} />
<ScrollView contentContainerStyle={styles.pb2}>
<Text style={[styles.ph5, styles.pb5]}>{translate('workspace.xero.organizationDescription')}</Text>
<SelectionList
ListItem={RadioListItem}
onSelectRow={saveSelection}
sections={[{data: sections}]}
initiallyFocusedOptionKey={organizationID}
/>
</ScrollView>
</ScreenWrapper>
</AccessOrNotFoundWrapper>
);
}

Expand Down

0 comments on commit db5a4e9

Please sign in to comment.