-
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 #48564 from DylanDylann/delegate-avatar
- Loading branch information
Showing
2 changed files
with
56 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import {useOnyx} from 'react-native-onyx'; | ||
import Avatar from '@components/Avatar'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import * as UserUtils from '@libs/UserUtils'; | ||
import CONST from '@src/CONST'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import ProfileAvatarWithIndicator from './ProfileAvatarWithIndicator'; | ||
|
||
type AvatarWithDelegateAvatarProps = { | ||
/** Emoji status */ | ||
delegateEmail: string; | ||
|
||
/** Whether the avatar is selected */ | ||
isSelected?: boolean; | ||
}; | ||
|
||
function AvatarWithDelegateAvatar({delegateEmail, isSelected = false}: AvatarWithDelegateAvatarProps) { | ||
const styles = useThemeStyles(); | ||
const personalDetails = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); | ||
const delegatePersonalDetail = Object.values(personalDetails[0] ?? {}).find((personalDetail) => personalDetail?.login?.toLowerCase() === delegateEmail); | ||
|
||
return ( | ||
<View style={styles.sidebarStatusAvatarContainer}> | ||
<ProfileAvatarWithIndicator isSelected={isSelected} /> | ||
<View style={[styles.sidebarStatusAvatar]}> | ||
<View style={styles.emojiStatusLHN}> | ||
<Avatar | ||
size={CONST.AVATAR_SIZE.SMALL} | ||
source={UserUtils.getSmallSizeAvatar(delegatePersonalDetail?.avatar, delegatePersonalDetail?.accountID)} | ||
fallbackIcon={delegatePersonalDetail?.fallbackIcon} | ||
type={CONST.ICON_TYPE_AVATAR} | ||
/> | ||
</View> | ||
</View> | ||
</View> | ||
); | ||
} | ||
|
||
AvatarWithDelegateAvatar.displayName = 'AvatarWithDelegateAvatar'; | ||
|
||
export default AvatarWithDelegateAvatar; |
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