Skip to content

Commit 2511059

Browse files
authored
feat!: remove ai assistant button (#2535)
1 parent 512cf15 commit 2511059

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

src/components/ComponentsProvider/componentsRegistry.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const componentsRegistryInner = new Registry()
1313
.register('AsideNavigation', AsideNavigation)
1414
.register('ErrorBoundary', ErrorBoundaryInner)
1515
.register('ShardsTable', ShardsTable)
16-
.register('AIAssistantButton', EmptyPlaceholder)
1716
.register('ChatPanel', EmptyPlaceholder);
1817

1918
export type ComponentsRegistry = ComponentsRegistryTemplate<typeof componentsRegistryInner>;

src/containers/AsideNavigation/hooks/useHotkeysPanel.tsx

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22

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

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

16-
export const HOTKEYS = [
17+
export const DEFAULT_HOTKEY_GROUPS: HotkeysGroup[] = [
1718
{
1819
title: 'Query Editor',
1920
items: [
@@ -48,6 +49,7 @@ export const HOTKEYS = [
4849
export interface HotkeysPanelProps {
4950
visible: boolean;
5051
closePanel: () => void;
52+
hotkeyGroups?: HotkeysGroup[];
5153
}
5254

5355
/**
@@ -60,7 +62,11 @@ export interface HotkeysPanelProps {
6062
* This wrapper ensures the component mounts first, then sets visible=true in a subsequent render cycle
6163
* to make transition actually happen.
6264
*/
63-
export const HotkeysPanelWrapper = ({visible: propsVisible, closePanel}: HotkeysPanelProps) => {
65+
export const HotkeysPanelWrapper = ({
66+
visible: propsVisible,
67+
closePanel,
68+
hotkeyGroups = DEFAULT_HOTKEY_GROUPS,
69+
}: HotkeysPanelProps) => {
6470
const [visible, setVisible] = React.useState(false);
6571

6672
React.useEffect(() => {
@@ -70,7 +76,7 @@ export const HotkeysPanelWrapper = ({visible: propsVisible, closePanel}: Hotkeys
7076
return (
7177
<UIKitHotkeysPanel
7278
visible={visible}
73-
hotkeys={HOTKEYS}
79+
hotkeys={hotkeyGroups}
7480
className={b('hotkeys-panel')}
7581
title={
7682
<div className={b('hotkeys-panel-title')}>
@@ -87,9 +93,15 @@ interface UseHotkeysPanel {
8793
isPanelVisible: boolean;
8894
openPanel: () => void;
8995
closePanel: () => void;
96+
hotkeyGroups?: HotkeysGroup[];
9097
}
9198

92-
export const useHotkeysPanel = ({isPanelVisible, openPanel, closePanel}: UseHotkeysPanel) => {
99+
export const useHotkeysPanel = ({
100+
isPanelVisible,
101+
openPanel,
102+
closePanel,
103+
hotkeyGroups = DEFAULT_HOTKEY_GROUPS,
104+
}: UseHotkeysPanel) => {
93105
React.useEffect(() => {
94106
hotkeys(SHORTCUTS_HOTKEY, openPanel);
95107

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

104116
const renderPanel = React.useCallback(
105-
() => <HotkeysPanelWrapper visible={isPanelVisible} closePanel={closePanel} />,
106-
[isPanelVisible, closePanel],
117+
() => (
118+
<HotkeysPanelWrapper
119+
visible={isPanelVisible}
120+
closePanel={closePanel}
121+
hotkeyGroups={hotkeyGroups}
122+
/>
123+
),
124+
[isPanelVisible, closePanel, hotkeyGroups],
107125
);
108126

109127
return {

src/containers/Header/Header.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {ArrowUpRightFromSquare, CirclePlus, PlugConnection} from '@gravity-ui/ic
44
import {Breadcrumbs, Button, Divider, Flex, Icon} from '@gravity-ui/uikit';
55
import {useLocation} from 'react-router-dom';
66

7-
import {componentsRegistry} from '../../components/ComponentsProvider/componentsRegistry';
87
import {getConnectToDBDialog} from '../../components/ConnectToDB/ConnectToDBDialog';
98
import {InternalLink} from '../../components/InternalLink';
109
import {useAddClusterFeatureAvailable} from '../../store/reducers/capabilities/hooks';
@@ -77,11 +76,6 @@ function Header() {
7776
);
7877
}
7978

80-
if (componentsRegistry.has('AIAssistantButton')) {
81-
const AIAssistantButton = componentsRegistry.get('AIAssistantButton');
82-
elements.push(<AIAssistantButton key="ai-assistant" />);
83-
}
84-
8579
if (!isClustersPage && isUserAllowedToMakeChanges) {
8680
elements.push(
8781
<Button view="flat" href={createDeveloperUIInternalPageHref()} target="_blank">

0 commit comments

Comments
 (0)