@@ -7,16 +7,13 @@ import {InteractionManager, View} from 'react-native';
7
7
import type { OnyxEntry } from 'react-native-onyx' ;
8
8
import { withOnyx } from 'react-native-onyx' ;
9
9
import Badge from '@components/Badge' ;
10
- import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView' ;
11
10
import Button from '@components/Button' ;
12
11
import ButtonWithDropdownMenu from '@components/ButtonWithDropdownMenu' ;
13
12
import type { DropdownOption , WorkspaceMemberBulkActionType } from '@components/ButtonWithDropdownMenu/types' ;
14
13
import ConfirmModal from '@components/ConfirmModal' ;
15
- import HeaderWithBackButton from '@components/HeaderWithBackButton' ;
16
14
import * as Expensicons from '@components/Icon/Expensicons' ;
17
15
import * as Illustrations from '@components/Icon/Illustrations' ;
18
16
import MessagesRow from '@components/MessagesRow' ;
19
- import ScreenWrapper from '@components/ScreenWrapper' ;
20
17
import SelectionList from '@components/SelectionList' ;
21
18
import TableListItem from '@components/SelectionList/TableListItem' ;
22
19
import type { ListItem , SelectionListHandle } from '@components/SelectionList/types' ;
@@ -48,6 +45,7 @@ import type {Errors, PendingAction} from '@src/types/onyx/OnyxCommon';
48
45
import { isEmptyObject } from '@src/types/utils/EmptyObject' ;
49
46
import type { WithPolicyAndFullscreenLoadingProps } from './withPolicyAndFullscreenLoading' ;
50
47
import withPolicyAndFullscreenLoading from './withPolicyAndFullscreenLoading' ;
48
+ import WorkspacePageWithSections from './WorkspacePageWithSections' ;
51
49
52
50
type WorkspaceMembersPageOnyxProps = {
53
51
/** Session info for the currently logged in user. */
@@ -71,7 +69,7 @@ function invertObject(object: Record<string, string>): Record<string, string> {
71
69
72
70
type MemberOption = Omit < ListItem , 'accountID' > & { accountID : number } ;
73
71
74
- function WorkspaceMembersPage ( { personalDetails, invitedEmailsToAccountIDsDraft, route, policy, session, currentUserPersonalDetails, isLoadingReportData = true } : WorkspaceMembersPageProps ) {
72
+ function WorkspaceMembersPage ( { personalDetails, invitedEmailsToAccountIDsDraft, route, policy, session, currentUserPersonalDetails} : WorkspaceMembersPageProps ) {
75
73
const policyMemberEmailsToAccountIDs = useMemo ( ( ) => PolicyUtils . getMemberAccountIDsForWorkspace ( policy ?. employeeList , true ) , [ policy ?. employeeList ] ) ;
76
74
const styles = useThemeStyles ( ) ;
77
75
const StyleUtils = useStyleUtils ( ) ;
@@ -526,74 +524,65 @@ function WorkspaceMembersPage({personalDetails, invitedEmailsToAccountIDsDraft,
526
524
} ;
527
525
528
526
return (
529
- < ScreenWrapper
530
- includeSafeAreaPaddingBottom = { false }
531
- style = { [ styles . defaultModalContainer ] }
527
+ < WorkspacePageWithSections
528
+ headerText = { translate ( 'workspace.common.members' ) }
529
+ route = { route }
530
+ guidesCallTaskID = { CONST . GUIDES_CALL_TASK_IDS . WORKSPACE_MEMBERS }
531
+ headerContent = { ! isSmallScreenWidth && getHeaderButtons ( ) }
532
+ icon = { Illustrations . ReceiptWrangler }
532
533
testID = { WorkspaceMembersPage . displayName }
534
+ shouldShowLoading = { false }
533
535
shouldShowOfflineIndicatorInWideScreen
536
+ shouldShowNonAdmin
534
537
>
535
- < FullPageNotFoundView
536
- shouldShow = { ( isEmptyObject ( policy ) && ! isLoadingReportData ) || PolicyUtils . isPendingDeletePolicy ( policy ) }
537
- subtitleKey = { isEmptyObject ( policy ) ? undefined : 'workspace.common.notAuthorized' }
538
- onBackButtonPress = { PolicyUtils . goBackFromInvalidPolicy }
539
- onLinkPress = { PolicyUtils . goBackFromInvalidPolicy }
540
- >
541
- < HeaderWithBackButton
542
- title = { translate ( 'workspace.common.members' ) }
543
- icon = { Illustrations . ReceiptWrangler }
544
- onBackButtonPress = { ( ) => {
545
- Navigation . goBack ( ) ;
546
- } }
547
- shouldShowBackButton = { isSmallScreenWidth }
548
- guidesCallTaskID = { CONST . GUIDES_CALL_TASK_IDS . WORKSPACE_MEMBERS }
549
- >
550
- { ! isSmallScreenWidth && getHeaderButtons ( ) }
551
- </ HeaderWithBackButton >
552
- { isSmallScreenWidth && < View style = { [ styles . pl5 , styles . pr5 ] } > { getHeaderButtons ( ) } </ View > }
553
- < ConfirmModal
554
- danger
555
- title = { translate ( 'workspace.people.removeMembersTitle' ) }
556
- isVisible = { removeMembersConfirmModalVisible }
557
- onConfirm = { removeUsers }
558
- onCancel = { ( ) => setRemoveMembersConfirmModalVisible ( false ) }
559
- prompt = { confirmModalPrompt }
560
- confirmText = { translate ( 'common.remove' ) }
561
- cancelText = { translate ( 'common.cancel' ) }
562
- onModalHide = { ( ) => {
563
- InteractionManager . runAfterInteractions ( ( ) => {
564
- if ( ! textInputRef . current ) {
565
- return ;
566
- }
567
- textInputRef . current . focus ( ) ;
568
- } ) ;
569
- } }
570
- />
571
- < View style = { [ styles . w100 , styles . flex1 ] } >
572
- < SelectionList
573
- ref = { selectionListRef }
574
- canSelectMultiple = { isPolicyAdmin }
575
- sections = { [ { data, isDisabled : false } ] }
576
- ListItem = { TableListItem }
577
- shouldUseUserSkeletonView
578
- disableKeyboardShortcuts = { removeMembersConfirmModalVisible }
579
- headerMessage = { getHeaderMessage ( ) }
580
- headerContent = { ! isSmallScreenWidth && getHeaderContent ( ) }
581
- onSelectRow = { openMemberDetails }
582
- shouldDebounceRowSelect = { ! isPolicyAdmin }
583
- onCheckboxPress = { ( item ) => toggleUser ( item . accountID ) }
584
- onSelectAll = { ( ) => toggleAllUsers ( data ) }
585
- onDismissError = { dismissError }
586
- showLoadingPlaceholder = { isLoading }
587
- shouldPreventDefaultFocusOnSelectRow = { ! DeviceCapabilities . canUseTouchScreen ( ) }
588
- textInputRef = { textInputRef }
589
- customListHeader = { getCustomListHeader ( ) }
590
- listHeaderWrapperStyle = { [ styles . ph9 , styles . pv3 , styles . pb5 ] }
591
- listHeaderContent = { isSmallScreenWidth ? < View style = { [ styles . pl5 , styles . pr5 ] } > { getHeaderContent ( ) } </ View > : null }
592
- showScrollIndicator = { false }
538
+ { ( ) => (
539
+ < >
540
+ { isSmallScreenWidth && < View style = { [ styles . pl5 , styles . pr5 ] } > { getHeaderButtons ( ) } </ View > }
541
+ < ConfirmModal
542
+ danger
543
+ title = { translate ( 'workspace.people.removeMembersTitle' ) }
544
+ isVisible = { removeMembersConfirmModalVisible }
545
+ onConfirm = { removeUsers }
546
+ onCancel = { ( ) => setRemoveMembersConfirmModalVisible ( false ) }
547
+ prompt = { confirmModalPrompt }
548
+ confirmText = { translate ( 'common.remove' ) }
549
+ cancelText = { translate ( 'common.cancel' ) }
550
+ onModalHide = { ( ) => {
551
+ InteractionManager . runAfterInteractions ( ( ) => {
552
+ if ( ! textInputRef . current ) {
553
+ return ;
554
+ }
555
+ textInputRef . current . focus ( ) ;
556
+ } ) ;
557
+ } }
593
558
/>
594
- </ View >
595
- </ FullPageNotFoundView >
596
- </ ScreenWrapper >
559
+ < View style = { [ styles . w100 , styles . flex1 ] } >
560
+ < SelectionList
561
+ ref = { selectionListRef }
562
+ canSelectMultiple = { isPolicyAdmin }
563
+ sections = { [ { data, isDisabled : false } ] }
564
+ ListItem = { TableListItem }
565
+ shouldUseUserSkeletonView
566
+ disableKeyboardShortcuts = { removeMembersConfirmModalVisible }
567
+ headerMessage = { getHeaderMessage ( ) }
568
+ headerContent = { ! isSmallScreenWidth && getHeaderContent ( ) }
569
+ onSelectRow = { openMemberDetails }
570
+ shouldDebounceRowSelect = { ! isPolicyAdmin }
571
+ onCheckboxPress = { ( item ) => toggleUser ( item . accountID ) }
572
+ onSelectAll = { ( ) => toggleAllUsers ( data ) }
573
+ onDismissError = { dismissError }
574
+ showLoadingPlaceholder = { isLoading }
575
+ shouldPreventDefaultFocusOnSelectRow = { ! DeviceCapabilities . canUseTouchScreen ( ) }
576
+ textInputRef = { textInputRef }
577
+ customListHeader = { getCustomListHeader ( ) }
578
+ listHeaderWrapperStyle = { [ styles . ph9 , styles . pv3 , styles . pb5 ] }
579
+ listHeaderContent = { isSmallScreenWidth ? < View style = { [ styles . pl5 , styles . pr5 ] } > { getHeaderContent ( ) } </ View > : null }
580
+ showScrollIndicator = { false }
581
+ />
582
+ </ View >
583
+ </ >
584
+ ) }
585
+ </ WorkspacePageWithSections >
597
586
) ;
598
587
}
599
588
0 commit comments