File tree Expand file tree Collapse file tree 3 files changed +16
-11
lines changed
Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Original file line number Diff line number Diff line change 11import { useRef , useState } from 'react' ;
2- import { useRecoilValue , useSetRecoilState } from 'recoil' ;
2+ import { useRecoilState , useRecoilValue } from 'recoil' ;
33import {
44 Avatar ,
55 ShellBar ,
66 ShellBarItem ,
77 ListItemStandard ,
8+ ToggleButton ,
89} from '@ui5/webcomponents-react' ;
910
1011import { useTranslation } from 'react-i18next' ;
@@ -45,7 +46,9 @@ export function Header() {
4546 const clusters = useRecoilValue ( clustersState ) ;
4647
4748 const { isEnabled : isKymaCompanionEnabled } = useFeature ( 'KYMA_COMPANION' ) ;
48- const setShowCompanion = useSetRecoilState ( showKymaCompanionState ) ;
49+ const [ showCompanion , setShowCompanion ] = useRecoilState (
50+ showKymaCompanionState ,
51+ ) ;
4952 const shellbarRef = useRef ( null ) ;
5053
5154 const inactiveClusterNames = Object . keys ( clusters || { } ) . filter (
@@ -148,16 +151,18 @@ export function Header() {
148151 { isKymaCompanionEnabled &&
149152 isSAPUser &&
150153 window . location . pathname !== '/clusters' && (
151- < ShellBarItem
152- onClick = { ( ) =>
154+ < ToggleButton
155+ accessibleName = "Kyma Companion"
156+ icon = { showCompanion . show ? 'da-2' : 'da' }
157+ onClick = { e => {
158+ e . preventDefault ( ) ;
153159 setShowCompanion ( {
154160 show : true ,
155161 fullScreen : false ,
156- } )
157- }
158- icon = "da"
159- text = { t ( 'kyma-companion.name' ) }
160- title = { t ( 'kyma-companion.name' ) }
162+ } ) ;
163+ } }
164+ pressed = { showCompanion . show }
165+ slot = "assistant"
161166 />
162167 ) }
163168 </ ShellBar >
Original file line number Diff line number Diff line change 11Cypress . Commands . add ( 'openCompanion' , ( ) => {
22 cy . get ( 'ui5-shellbar' )
3- . find ( 'ui5-button[icon="da"]' )
3+ . find ( 'ui5-toggle- button[icon="da"]' )
44 . should ( 'be.visible' )
55 . click ( ) ;
66} ) ;
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ context('Test Companion UI', () => {
6767 cy . wait ( 1000 ) ;
6868
6969 cy . get ( '@shellbar' )
70- . find ( 'ui5-button[icon="da"]' )
70+ . find ( 'ui5-toggle- button[icon="da"]' )
7171 . should ( 'not.exist' ) ;
7272 } ) ;
7373 } ) ;
You can’t perform that action at this time.
0 commit comments