-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37961 from burczu/bugfix/37927-issues-member-details
#37927 bugfix: member details issues
- Loading branch information
Showing
11 changed files
with
121 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/pages/workspace/members/WorkspaceMemberDetailsRoleSelectionModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
import Modal from '@components/Modal'; | ||
import ScreenWrapper from '@components/ScreenWrapper'; | ||
import SelectionList from '@components/SelectionList'; | ||
import RadioListItem from '@components/SelectionList/RadioListItem'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import CONST from '@src/CONST'; | ||
|
||
type ListItemType = { | ||
value: typeof CONST.POLICY.ROLE.ADMIN | typeof CONST.POLICY.ROLE.USER; | ||
text: string; | ||
isSelected: boolean; | ||
keyForList: typeof CONST.POLICY.ROLE.ADMIN | typeof CONST.POLICY.ROLE.USER; | ||
}; | ||
|
||
type WorkspaceMemberDetailsPageProps = { | ||
/** Whether the modal is visible */ | ||
isVisible: boolean; | ||
|
||
/** The list of items to render */ | ||
items: ListItemType[]; | ||
|
||
/** Function to call when the user selects a role */ | ||
onRoleChange: ({value}: ListItemType) => void; | ||
|
||
/** Function to call when the user closes the role selection modal */ | ||
onClose: () => void; | ||
}; | ||
|
||
function WorkspaceMemberDetailsRoleSelectionModal({isVisible, items, onRoleChange, onClose}: WorkspaceMemberDetailsPageProps) { | ||
const {translate} = useLocalize(); | ||
const styles = useThemeStyles(); | ||
|
||
return ( | ||
<Modal | ||
type={CONST.MODAL.MODAL_TYPE.RIGHT_DOCKED} | ||
isVisible={isVisible} | ||
onClose={() => onClose?.()} | ||
onModalHide={onClose} | ||
hideModalContentWhileAnimating | ||
useNativeDriver | ||
> | ||
<ScreenWrapper testID={WorkspaceMemberDetailsRoleSelectionModal.displayName}> | ||
<HeaderWithBackButton | ||
title={translate('common.role')} | ||
onBackButtonPress={onClose} | ||
/> | ||
<View style={[styles.containerWithSpaceBetween, styles.pointerEventsBoxNone]}> | ||
<SelectionList | ||
sections={[{data: items}]} | ||
ListItem={RadioListItem} | ||
onSelectRow={onRoleChange} | ||
initiallyFocusedOptionKey={items.find((item) => item.isSelected)?.keyForList} | ||
/> | ||
</View> | ||
</ScreenWrapper> | ||
</Modal> | ||
); | ||
} | ||
|
||
WorkspaceMemberDetailsRoleSelectionModal.displayName = 'WorkspaceMemberDetailsRoleSelectionModal'; | ||
|
||
export type {ListItemType}; | ||
|
||
export default WorkspaceMemberDetailsRoleSelectionModal; |
87 changes: 0 additions & 87 deletions
87
src/pages/workspace/members/WorkspaceMemberDetailsRoleSelectionPage.tsx
This file was deleted.
Oops, something went wrong.