import { AiIconAnimation, cn, KeyboardShortcut } from 'ui' import { SIDEBAR_KEYS } from '@/components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider' import { ButtonTooltip } from '@/components/ui/ButtonTooltip' import { useTrack } from '@/lib/telemetry/track' import { SHORTCUT_IDS } from '@/state/shortcuts/registry' import { useIsShortcutEnabled } from '@/state/shortcuts/useIsShortcutEnabled' import { useSidebarManagerSnapshot } from '@/state/sidebar-manager-state' export const AssistantButton = () => { const { activeSidebar, toggleSidebar } = useSidebarManagerSnapshot() const isAIAssistantHotkeyEnabled = useIsShortcutEnabled(SHORTCUT_IDS.AI_ASSISTANT_TOGGLE) const track = useTrack() const isOpen = activeSidebar?.id === SIDEBAR_KEYS.AI_ASSISTANT return ( { track('header_assistant_button_clicked') toggleSidebar(SIDEBAR_KEYS.AI_ASSISTANT) }} tooltip={{ content: { className: 'p-1 pl-2.5', text: (
AI Assistant {isAIAssistantHotkeyEnabled && }
), }, }} > AI Assistant
) }