11import  { 
22  Avatar , 
3+   Button , 
4+   ButtonDomRef , 
5+   Icon , 
36  List , 
47  ListItemStandard , 
58  Popover , 
@@ -9,16 +12,21 @@ import {
912  Ui5CustomEvent , 
1013}  from  '@ui5/webcomponents-react' ; 
1114import  {  useAuth  }  from  'react-oidc-context' ; 
12- import  {  RefObject ,  useRef ,  useState  }  from  'react' ; 
15+ import  {  RefObject ,  useEffect ,   useRef ,  useState  }  from  'react' ; 
1316import  {  ShellBarProfileClickEventDetail  }  from  '@ui5/webcomponents-fiori/dist/ShellBar.js' ; 
1417import  PopoverPlacement  from  '@ui5/webcomponents/dist/types/PopoverPlacement.js' ; 
1518import  {  useTranslation  }  from  'react-i18next' ; 
1619import  {  generateInitialsForEmail  }  from  '../Helper/GenerateInitialsForEmail' ; 
20+ import  styles  from  './ShellBar.module.css' ; 
21+ import  {  ThemingParameters  }  from  '@ui5/webcomponents-react-base' ; 
1722
1823export  function  ShellBarComponent ( )  { 
1924  const  auth  =  useAuth ( ) ; 
2025  const  profilePopoverRef  =  useRef < PopoverDomRef > ( null ) ; 
26+   const  betaPopoverRef  =  useRef < PopoverDomRef > ( null ) ; 
2127  const  [ profilePopoverOpen ,  setProfilePopoverOpen ]  =  useState ( false ) ; 
28+   const  [ betaPopoverOpen ,  setBetaPopoverOpen ]  =  useState ( false ) ; 
29+   const  betaButtonRef  =  useRef < ButtonDomRef > ( null ) ; 
2230
2331  const  onProfileClick  =  ( 
2432    e : Ui5CustomEvent < ShellBarDomRef ,  ShellBarProfileClickEventDetail > , 
@@ -27,24 +35,65 @@ export function ShellBarComponent() {
2735    setProfilePopoverOpen ( ! profilePopoverOpen ) ; 
2836  } ; 
2937
38+   const  onBetaClick  =  ( )  =>  { 
39+     if  ( betaButtonRef . current )  { 
40+       betaPopoverRef . current ! . opener  =  betaButtonRef . current ; 
41+       setBetaPopoverOpen ( ! betaPopoverOpen ) ; 
42+     } 
43+   } ; 
44+ 
45+   useEffect ( ( )  =>  { 
46+     const  shellbar  =  document . querySelector ( 'ui5-shellbar' ) ; 
47+     const  el  =  shellbar ?. shadowRoot ?. querySelector ( 
48+       '.ui5-shellbar-overflow-container-left' , 
49+     ) ; 
50+ 
51+     if  ( el )  { 
52+       ( el  as  HTMLElement ) . style . backgroundColor  =  'red' ; 
53+     } 
54+   } ,  [ ] ) ; 
55+ 
3056  return  ( 
3157    < > 
3258      < ShellBar 
33-         logo = { < img  src = "/logo.png"  alt = "MCP"  /> } 
34-         primaryTitle = "MCP" 
59+         className = { styles . TestShellbar } 
3560        profile = { 
3661          < Avatar 
3762            initials = { generateInitialsForEmail ( auth . user ?. profile . email ) } 
3863            size = "XS" 
3964          /> 
4065        } 
66+         startButton = { 
67+           < div  className = { styles . container } > 
68+             < div  className = { styles . logoWrapper } > 
69+               < img  src = "/logo.png"  alt = "MCP"  className = { styles . logo }  /> 
70+               < span  className = { styles . logoText } > MCP</ span > 
71+             </ div > 
72+             < Button 
73+               ref = { betaButtonRef } 
74+               className = { styles . betaButton } 
75+               onClick = { onBetaClick } 
76+             > 
77+               < span  className = { styles . betaContent } > 
78+                 < Icon  name = "information"  className = { styles . betaIcon }  /> 
79+                 < span  className = { styles . betaText } > Beta</ span > 
80+               </ span > 
81+             </ Button > 
82+           </ div > 
83+         } 
4184        onProfileClick = { onProfileClick } 
4285      /> 
86+ 
4387      < ProfilePopover 
4488        open = { profilePopoverOpen } 
45-         setOpen = { ( b )   =>   setProfilePopoverOpen ( b ) } 
89+         setOpen = { setProfilePopoverOpen } 
4690        popoverRef = { profilePopoverRef } 
4791      /> 
92+       < BetaPopover 
93+         open = { betaPopoverOpen } 
94+         setOpen = { setBetaPopoverOpen } 
95+         popoverRef = { betaPopoverRef } 
96+       /> 
4897    </ > 
4998  ) ; 
5099} 
@@ -62,28 +111,55 @@ const ProfilePopover = ({
62111  const  {  t }  =  useTranslation ( ) ; 
63112
64113  return  ( 
65-     < > 
66-       < Popover 
67-         ref = { popoverRef } 
68-         placement = { PopoverPlacement . Bottom } 
69-         open = { open } 
70-         headerText = "Profile" 
71-         onClose = { ( )  =>  { 
72-           setOpen ( false ) ; 
114+     < Popover 
115+       ref = { popoverRef } 
116+       placement = { PopoverPlacement . Bottom } 
117+       open = { open } 
118+       headerText = "Profile" 
119+       onClose = { ( )  =>  setOpen ( false ) } 
120+     > 
121+       < List > 
122+         < ListItemStandard 
123+           icon = "log" 
124+           onClick = { ( )  =>  { 
125+             setOpen ( false ) ; 
126+             auth . removeUser ( ) ; 
127+           } } 
128+         > 
129+           { t ( 'ShellBar.signOutButton' ) } 
130+         </ ListItemStandard > 
131+       </ List > 
132+     </ Popover > 
133+   ) ; 
134+ } ; 
135+ 
136+ const  BetaPopover  =  ( { 
137+   open, 
138+   setOpen, 
139+   popoverRef, 
140+ } : { 
141+   open : boolean ; 
142+   setOpen : ( arg0 : boolean )  =>  void ; 
143+   popoverRef : RefObject < PopoverDomRef  |  null > ; 
144+ } )  =>  { 
145+   const  {  t }  =  useTranslation ( ) ; 
146+ 
147+   return  ( 
148+     < Popover 
149+       ref = { popoverRef } 
150+       placement = { PopoverPlacement . Bottom } 
151+       open = { open } 
152+       onClose = { ( )  =>  setOpen ( false ) } 
153+     > 
154+       < div 
155+         style = { { 
156+           padding : '1rem' , 
157+           maxWidth : '250px' , 
158+           fontFamily : ThemingParameters . sapFontFamily , 
73159        } } 
74160      > 
75-         < List > 
76-           < ListItemStandard 
77-             icon = "log" 
78-             onClick = { ( )  =>  { 
79-               setOpen ( false ) ; 
80-               auth . removeUser ( ) ; 
81-             } } 
82-           > 
83-             { t ( 'ShellBar.signOutButton' ) } 
84-           </ ListItemStandard > 
85-         </ List > 
86-       </ Popover > 
87-     </ > 
161+         { t ( 'ShellBar.betaButtonDescription' ) } 
162+       </ div > 
163+     </ Popover > 
88164  ) ; 
89165} ; 
0 commit comments