1
1
import React , { useCallback } from 'react' ;
2
+ import { useOnyx } from 'react-native-onyx' ;
2
3
import { PressableWithFeedback } from '@components/Pressable' ;
3
4
import Tooltip from '@components/Tooltip' ;
4
5
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails' ;
@@ -7,7 +8,9 @@ import useThemeStyles from '@hooks/useThemeStyles';
7
8
import interceptAnonymousUser from '@libs/interceptAnonymousUser' ;
8
9
import Navigation from '@libs/Navigation/Navigation' ;
9
10
import CONST from '@src/CONST' ;
11
+ import ONYXKEYS from '@src/ONYXKEYS' ;
10
12
import ROUTES from '@src/ROUTES' ;
13
+ import AvatarWithDelegateAvatar from './AvatarWithDelegateAvatar' ;
11
14
import AvatarWithOptionalStatus from './AvatarWithOptionalStatus' ;
12
15
import ProfileAvatarWithIndicator from './ProfileAvatarWithIndicator' ;
13
16
@@ -22,6 +25,8 @@ type BottomTabAvatarProps = {
22
25
function BottomTabAvatar ( { isCreateMenuOpen = false , isSelected = false } : BottomTabAvatarProps ) {
23
26
const styles = useThemeStyles ( ) ;
24
27
const { translate} = useLocalize ( ) ;
28
+ const [ account ] = useOnyx ( ONYXKEYS . ACCOUNT ) ;
29
+ const delegateEmail = account ?. delegatedAccess ?. delegate ?? '' ;
25
30
const currentUserPersonalDetails = useCurrentUserPersonalDetails ( ) ;
26
31
const emojiStatus = currentUserPersonalDetails ?. status ?. emojiCode ?? '' ;
27
32
@@ -36,7 +41,14 @@ function BottomTabAvatar({isCreateMenuOpen = false, isSelected = false}: BottomT
36
41
37
42
let children ;
38
43
39
- if ( emojiStatus ) {
44
+ if ( delegateEmail ) {
45
+ children = (
46
+ < AvatarWithDelegateAvatar
47
+ delegateEmail = { delegateEmail }
48
+ isSelected = { isSelected }
49
+ />
50
+ ) ;
51
+ } else if ( emojiStatus ) {
40
52
children = (
41
53
< AvatarWithOptionalStatus
42
54
emojiStatus = { emojiStatus }
0 commit comments