diff --git a/src/components/ComponentsProvider/componentsRegistry.ts b/src/components/ComponentsProvider/componentsRegistry.ts index abaa28d5b..d1bc72386 100644 --- a/src/components/ComponentsProvider/componentsRegistry.ts +++ b/src/components/ComponentsProvider/componentsRegistry.ts @@ -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; diff --git a/src/containers/AsideNavigation/hooks/useHotkeysPanel.tsx b/src/containers/AsideNavigation/hooks/useHotkeysPanel.tsx index c2e4fa58b..dd91f8582 100644 --- a/src/containers/AsideNavigation/hooks/useHotkeysPanel.tsx +++ b/src/containers/AsideNavigation/hooks/useHotkeysPanel.tsx @@ -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'; @@ -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: [ @@ -48,6 +49,7 @@ export const HOTKEYS = [ export interface HotkeysPanelProps { visible: boolean; closePanel: () => void; + hotkeyGroups?: HotkeysGroup[]; } /** @@ -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(() => { @@ -70,7 +76,7 @@ export const HotkeysPanelWrapper = ({visible: propsVisible, closePanel}: Hotkeys return ( @@ -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); @@ -102,8 +114,14 @@ export const useHotkeysPanel = ({isPanelVisible, openPanel, closePanel}: UseHotk }, [openPanel]); const renderPanel = React.useCallback( - () => , - [isPanelVisible, closePanel], + () => ( + + ), + [isPanelVisible, closePanel, hotkeyGroups], ); return { diff --git a/src/containers/Header/Header.tsx b/src/containers/Header/Header.tsx index 09c3f0b68..af0e3ef46 100644 --- a/src/containers/Header/Header.tsx +++ b/src/containers/Header/Header.tsx @@ -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'; @@ -77,11 +76,6 @@ function Header() { ); } - if (componentsRegistry.has('AIAssistantButton')) { - const AIAssistantButton = componentsRegistry.get('AIAssistantButton'); - elements.push(); - } - if (!isClustersPage && isUserAllowedToMakeChanges) { elements.push(