99 PopoverDomRef ,
1010 ShellBar ,
1111 ShellBarDomRef ,
12- ShellBarItem ,
13- ShellBarItemDomRef ,
14- TextAreaDomRef ,
1512 Ui5CustomEvent ,
1613} from '@ui5/webcomponents-react' ;
1714import { useAuthOnboarding } from '../../spaces/onboarding/auth/AuthContextOnboarding.tsx' ;
@@ -22,23 +19,16 @@ import { useTranslation } from 'react-i18next';
2219import { generateInitialsForEmail } from '../Helper/generateInitialsForEmail.ts' ;
2320import styles from './ShellBar.module.css' ;
2421import { ThemingParameters } from '@ui5/webcomponents-react-base' ;
25- import { ShellBarItemClickEventDetail } from '@ui5/webcomponents-fiori/dist/ShellBarItem.js' ;
2622
2723
2824export function ShellBarComponent ( ) {
2925 const auth = useAuthOnboarding ( ) ;
3026 const profilePopoverRef = useRef < PopoverDomRef > ( null ) ;
3127 const betaPopoverRef = useRef < PopoverDomRef > ( null ) ;
32- const feedbackPopoverRef = useRef < PopoverDomRef > ( null ) ;
3328 const [ profilePopoverOpen , setProfilePopoverOpen ] = useState ( false ) ;
3429 const [ betaPopoverOpen , setBetaPopoverOpen ] = useState ( false ) ;
35- const [ feedbackPopoverOpen , setFeedbackPopoverOpen ] = useState ( false ) ;
36- const [ rating , setRating ] = useState ( 0 ) ;
37- const [ feedbackMessage , setFeedbackMessage ] = useState ( '' ) ;
38- const [ feedbackSent , setFeedbackSent ] = useState ( false ) ;
3930 const betaButtonRef = useRef < ButtonDomRef > ( null ) ;
4031
41- const { user } = useAuthOnboarding ( ) ;
4232 const { t } = useTranslation ( ) ;
4333
4434 const onProfileClick = ( e : Ui5CustomEvent < ShellBarDomRef , ShellBarProfileClickEventDetail > ) => {
@@ -53,38 +43,6 @@ export function ShellBarComponent() {
5343 }
5444 } ;
5545
56- const onFeedbackClick = ( e : Ui5CustomEvent < ShellBarItemDomRef , ShellBarItemClickEventDetail > ) => {
57- feedbackPopoverRef . current ! . opener = e . detail . targetRef ;
58- setFeedbackPopoverOpen ( ! feedbackPopoverOpen ) ;
59- } ;
60-
61- const onFeedbackMessageChange = ( event : Ui5CustomEvent < TextAreaDomRef , { value : string ; previousValue : string } > ) => {
62- const newValue = event . target . value ;
63- setFeedbackMessage ( newValue ) ;
64- } ;
65-
66- async function onFeedbackSent ( ) {
67- const payload = {
68- message : feedbackMessage ,
69- rating : rating . toString ( ) ,
70- user : user ?. email ,
71- environment : window . location . hostname ,
72- } ;
73- try {
74- await fetch ( '/api/feedback' , {
75- method : 'POST' ,
76- headers : {
77- 'Content-Type' : 'application/json' ,
78- } ,
79- body : JSON . stringify ( payload ) ,
80- } ) ;
81- } catch ( err ) {
82- console . log ( err ) ;
83- } finally {
84- setFeedbackSent ( true ) ;
85- }
86- }
87-
8846 useEffect ( ( ) => {
8947 const shellbar = document . querySelector ( 'ui5-shellbar' ) ;
9048 const el = shellbar ?. shadowRoot ?. querySelector ( '.ui5-shellbar-overflow-container-left' ) ;
@@ -116,7 +74,6 @@ export function ShellBarComponent() {
11674 }
11775 onProfileClick = { onProfileClick }
11876 >
119- < ShellBarItem icon = "feedback" onClick = { onFeedbackClick } />
12077 </ ShellBar >
12178
12279 < ProfilePopover open = { profilePopoverOpen } setOpen = { setProfilePopoverOpen } popoverRef = { profilePopoverRef } />
0 commit comments