@@ -77,42 +77,43 @@ export const GlobalHeader: FC = () => {
7777 }
7878 } , [ orgsList ] )
7979
80- const shouldLoadDropdowns = activeOrg ?. id && activeAccount ?. id
81- const shouldLoadAvatar =
80+ const shouldLoadDropdowns = Boolean ( activeOrg ?. id && activeAccount ?. id )
81+ const shouldLoadAvatar = Boolean (
8282 user ?. firstName && user ?. lastName && user ?. email && org ?. id
83- const shouldLoadGlobalHeader = shouldLoadDropdowns || shouldLoadAvatar
83+ )
84+ const shouldLoadGlobalHeader = Boolean (
85+ shouldLoadDropdowns || shouldLoadAvatar
86+ )
8487
8588 const caretStyle = { fontSize : '18px' , color : InfluxColors . Grey65 }
8689
87- return (
88- shouldLoadGlobalHeader && (
89- < FlexBox
90- className = "multiaccountorg--header"
91- justifyContent = { JustifyContent . SpaceBetween }
92- margin = { ComponentSize . Large }
93- testID = "global-header--container"
94- >
95- { shouldLoadDropdowns && (
96- < FlexBox margin = { ComponentSize . Medium } >
97- < AccountDropdown
98- activeAccount = { activeAccount }
99- activeOrg = { activeOrg }
100- accountsList = { sortedAccounts }
101- />
102- < Icon glyph = { IconFont . CaretOutlineRight } style = { caretStyle } />
103- < OrgDropdown activeOrg = { activeOrg } orgsList = { sortedOrgs } />
104- </ FlexBox >
105- ) }
106-
107- { shouldLoadAvatar && (
108- < IdentityUserAvatar
109- email = { user . email }
110- firstName = { user . firstName }
111- lastName = { user . lastName }
112- orgId = { org . id }
90+ return shouldLoadGlobalHeader ? (
91+ < FlexBox
92+ className = "multiaccountorg--header"
93+ justifyContent = { JustifyContent . SpaceBetween }
94+ margin = { ComponentSize . Large }
95+ testID = "global-header--container"
96+ >
97+ { shouldLoadDropdowns && (
98+ < FlexBox margin = { ComponentSize . Medium } >
99+ < AccountDropdown
100+ activeAccount = { activeAccount }
101+ activeOrg = { activeOrg }
102+ accountsList = { sortedAccounts }
113103 />
114- ) }
115- </ FlexBox >
116- )
117- )
104+ < Icon glyph = { IconFont . CaretOutlineRight } style = { caretStyle } />
105+ < OrgDropdown activeOrg = { activeOrg } orgsList = { sortedOrgs } />
106+ </ FlexBox >
107+ ) }
108+
109+ { shouldLoadAvatar && (
110+ < IdentityUserAvatar
111+ email = { user . email }
112+ firstName = { user . firstName }
113+ lastName = { user . lastName }
114+ orgId = { org . id }
115+ />
116+ ) }
117+ </ FlexBox >
118+ ) : null
118119}
0 commit comments