10000 feat: Use togglebutton instead of the shellbar item for an ai assistant button by mrCherry97 · Pull Request #3898 · kyma-project/busola · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: Use togglebutton instead of the shellbar item for an ai assistant button #3898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions src/header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { useRef, useState } from 'react';
import { useRecoilValue, useSetRecoilState } from 'recoil';
import { useRecoilState, useRecoilValue } from 'recoil';
import {
Avatar,
ShellBar,
ShellBarItem,
ListItemStandard,
ToggleButton,
} from '@ui5/webcomponents-react';

import { useTranslation } from 'react-i18next';
Expand Down Expand Up @@ -45,7 +46,9 @@ export function Header() {
const clusters = useRecoilValue(clustersState);

const { isEnabled: isKymaCompanionEnabled } = useFeature('KYMA_COMPANION');
const setShowCompanion = useSetRecoilState(showKymaCompanionState);
const [showCompanion, setShowCompanion] = useRecoilState(
showKymaCompanionState,
);
const shellbarRef = useRef(null);

const inactiveClusterNames = Object.keys(clusters || {}).filter(
Expand Down Expand Up @@ -148,16 +151,18 @@ export function Header() {
{isKymaCompanionEnabled &&
isSAPUser &&
window.location.pathname !== '/clusters' && (
<ShellBarItem
=>
<ToggleButton
accessibleName="Kyma Companion"
icon={showCompanion.show ? 'da-2' : 'da'}
=> {
e.preventDefault();
setShowCompanion({
show: true,
fullScreen: false,
})
}
icon="da"
text={t('kyma-companion.name')}
title={t('kyma-companion.name')}
});
}}
pressed={showCompanion.show}
slot="assistant"
/>
)}
</ShellBar>
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/support/companion-commands.js
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Cypress.Commands.add('openCompanion', () => {
cy.get('ui5-shellbar')
.find('ui5-button[icon="da"]')
.find('ui5-toggle-button[icon="da"]')
.should('be.visible')
.click();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ context('Test Companion UI', () => {
cy.wait(1000);

cy.get('@shellbar')
.find('ui5-button[icon="da"]')
.find('ui5-toggle-button[icon="da"]')
.should('not.exist');
});
});
Expand Down
Loading
0