Skip to content

Commit 2bf10b7

Browse files
committed
fixes after c+
1 parent 7a94f5d commit 2bf10b7

4 files changed

Lines changed: 29 additions & 15 deletions

File tree

src/pages/workspace/duplicate/WorkspaceDuplicateForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ function WorkspaceDuplicateForm({policyID}: WorkspaceDuplicateFormProps) {
6363

6464
const onSubmit = useCallback(
6565
({name, avatarFile}: {name?: string; avatarFile?: File | CustomRNImageManipulatorResult}) => {
66-
const newPolicyID = generatePolicyID();
67-
setDuplicateWorkspaceData({policyID: newPolicyID, name, file: avatarFile});
6866
if (policyID) {
67+
const newPolicyID = generatePolicyID();
68+
setDuplicateWorkspaceData({policyID: newPolicyID, name, file: avatarFile});
6969
Navigation.navigate(ROUTES.WORKSPACE_DUPLICATE_SELECT_FEATURES.getRoute(policyID));
7070
}
7171
},

src/pages/workspace/duplicate/WorkspaceDuplicatePage.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import React, {useEffect} from 'react';
33
import ScreenWrapper from '@components/ScreenWrapper';
44
import type {PlatformStackRouteProp} from '@navigation/PlatformStackNavigation/types';
55
import type {WorkspaceDuplicateNavigatorParamList} from '@navigation/types';
6+
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';
67
import {clearDuplicateWorkspace} from '@userActions/Policy/Policy';
8+
import CONST from '@src/CONST';
79
import type SCREENS from '@src/SCREENS';
810
import WorkspaceDuplicateForm from './WorkspaceDuplicateForm';
911

@@ -14,13 +16,18 @@ function WorkspaceDuplicatePage() {
1416
useEffect(clearDuplicateWorkspace, []);
1517

1618
return (
17-
<ScreenWrapper
18-
enableEdgeToEdgeBottomSafeAreaPadding
19-
shouldEnableMaxHeight
20-
testID={WorkspaceDuplicatePage.displayName}
19+
<AccessOrNotFoundWrapper
20+
policyID={policyID}
21+
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN]}
2122
>
22-
<WorkspaceDuplicateForm policyID={policyID} />
23-
</ScreenWrapper>
23+
<ScreenWrapper
24+
enableEdgeToEdgeBottomSafeAreaPadding
25+
shouldEnableMaxHeight
26+
testID={WorkspaceDuplicatePage.displayName}
27+
>
28+
<WorkspaceDuplicateForm policyID={policyID} />
29+
</ScreenWrapper>
30+
</AccessOrNotFoundWrapper>
2431
);
2532
}
2633

src/pages/workspace/duplicate/WorkspaceDuplicateSelectFeaturesForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ function WorkspaceDuplicateSelectFeaturesForm({policyID}: WorkspaceDuplicateForm
164164
: undefined,
165165
];
166166

167-
return result.filter((item): item is NonNullable<typeof item> => item !== undefined);
167+
return result.filter((item): item is NonNullable<typeof item> => !!item);
168168
}, [
169169
policy,
170170
translate,

src/pages/workspace/duplicate/WorkspaceDuplicateSelectFeaturesPage.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import React from 'react';
33
import ScreenWrapper from '@components/ScreenWrapper';
44
import type {PlatformStackRouteProp} from '@navigation/PlatformStackNavigation/types';
55
import type {WorkspaceDuplicateNavigatorParamList} from '@navigation/types';
6+
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';
7+
import CONST from '@src/CONST';
68
import type SCREENS from '@src/SCREENS';
79
import WorkspaceDuplicateSelectFeaturesForm from './WorkspaceDuplicateSelectFeaturesForm';
810

@@ -11,13 +13,18 @@ function WorkspaceDuplicateSelectFeaturesPage() {
1113
const policyID = route?.params?.policyID;
1214

1315
return (
14-
<ScreenWrapper
15-
enableEdgeToEdgeBottomSafeAreaPadding
16-
shouldEnableMaxHeight
17-
testID={WorkspaceDuplicateSelectFeaturesPage.displayName}
16+
<AccessOrNotFoundWrapper
17+
policyID={policyID}
18+
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN]}
1819
>
19-
<WorkspaceDuplicateSelectFeaturesForm policyID={policyID} />
20-
</ScreenWrapper>
20+
<ScreenWrapper
21+
enableEdgeToEdgeBottomSafeAreaPadding
22+
shouldEnableMaxHeight
23+
testID={WorkspaceDuplicateSelectFeaturesPage.displayName}
24+
>
25+
<WorkspaceDuplicateSelectFeaturesForm policyID={policyID} />
26+
</ScreenWrapper>
27+
</AccessOrNotFoundWrapper>
2128
);
2229
}
2330

0 commit comments

Comments
 (0)