Skip to content

feat!: remove ai assistant button #2535

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 1 commit into from
Jul 3, 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
1 change: 0 additions & 1 deletion src/components/ComponentsProvider/componentsRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const componentsRegistryInner = new Registry()
.register('AsideNavigation', AsideNavigation)
.register('ErrorBoundary', ErrorBoundaryInner)
.register('ShardsTable', ShardsTable)
.register('AIAssistantButton', EmptyPlaceholder)
.register('ChatPanel', EmptyPlaceholder);

export type ComponentsRegistry = ComponentsRegistryTemplate<typeof componentsRegistryInner>;
Expand Down
30 changes: 24 additions & 6 deletions src/containers/AsideNavigation/hooks/useHotkeysPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';

import type {HotkeysGroup} from '@gravity-ui/navigation';
import {HotkeysPanel as UIKitHotkeysPanel} from '@gravity-ui/navigation';
import {Hotkey} from '@gravity-ui/uikit';
import hotkeys from 'hotkeys-js';
Expand All @@ -13,7 +14,7 @@ export const isMac = () => navigator.platform.toUpperCase().includes('MAC');

export const SHORTCUTS_HOTKEY = isMac() ? 'cmd+K' : 'ctrl+K';

export const HOTKEYS = [
export const DEFAULT_HOTKEY_GROUPS: HotkeysGroup[] = [
{
title: 'Query Editor',
items: [
Expand Down Expand Up @@ -48,6 +49,7 @@ export const HOTKEYS = [
export interface HotkeysPanelProps {
visible: boolean;
closePanel: () => void;
hotkeyGroups?: HotkeysGroup[];
}

/**
Expand All @@ -60,7 +62,11 @@ export interface HotkeysPanelProps {
* This wrapper ensures the component mounts first, then sets visible=true in a subsequent render cycle
* to make transition actually happen.
*/
export const HotkeysPanelWrapper = ({visible: propsVisible, closePanel}: HotkeysPanelProps) => {
export const HotkeysPanelWrapper = ({
visible: propsVisible,
closePanel,
hotkeyGroups = DEFAULT_HOTKEY_GROUPS,
}: HotkeysPanelProps) => {
const [visible, setVisible] = React.useState(false);

React.useEffect(() => {
Expand All @@ -70,7 +76,7 @@ export const HotkeysPanelWrapper = ({visible: propsVisible, closePanel}: Hotkeys
return (
<UIKitHotkeysPanel
visible={visible}
hotkeys={HOTKEYS}
hotkeys={hotkeyGroups}
className={b('hotkeys-panel')}
title={
<div className={b('hotkeys-panel-title')}>
Expand All @@ -87,9 +93,15 @@ interface UseHotkeysPanel {
isPanelVisible: boolean;
openPanel: () => void;
closePanel: () => void;
hotkeyGroups?: HotkeysGroup[];
}

export const useHotkeysPanel = ({isPanelVisible, openPanel, closePanel}: UseHotkeysPanel) => {
export const useHotkeysPanel = ({
isPanelVisible,
openPanel,
closePanel,
hotkeyGroups = DEFAULT_HOTKEY_GROUPS,
}: UseHotkeysPanel) => {
React.useEffect(() => {
hotkeys(SHORTCUTS_HOTKEY, openPanel);

Expand All @@ -102,8 +114,14 @@ export const useHotkeysPanel = ({isPanelVisible, openPanel, closePanel}: UseHotk
}, [openPanel]);

const renderPanel = React.useCallback(
() => <HotkeysPanelWrapper visible={isPanelVisible} closePanel={closePanel} />,
[isPanelVisible, closePanel],
() => (
<HotkeysPanelWrapper
visible={isPanelVisible}
closePanel={closePanel}
hotkeyGroups={hotkeyGroups}
/>
),
[isPanelVisible, closePanel, hotkeyGroups],
);

return {
Expand Down
6 changes: 0 additions & 6 deletions src/containers/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {ArrowUpRightFromSquare, CirclePlus, PlugConnection} from '@gravity-ui/ic
import {Breadcrumbs, Button, Divider, Flex, Icon} from '@gravity-ui/uikit';
import {useLocation} from 'react-router-dom';

import {componentsRegistry} from '../../components/ComponentsProvider/componentsRegistry';
import {getConnectToDBDialog} from '../../components/ConnectToDB/ConnectToDBDialog';
import {InternalLink} from '../../components/InternalLink';
import {useAddClusterFeatureAvailable} from '../../store/reducers/capabilities/hooks';
Expand Down Expand Up @@ -77,11 +76,6 @@ function Header() {
);
}

if (componentsRegistry.has('AIAssistantButton')) {
const AIAssistantButton = componentsRegistry.get('AIAssistantButton');
elements.push(<AIAssistantButton key="ai-assistant" />);
}

if (!isClustersPage && isUserAllowedToMakeChanges) {
elements.push(
<Button view="flat" href={createDeveloperUIInternalPageHref()} target="_blank">
Expand Down
Loading