import { IS_PLATFORM } from 'common' import { ChevronLeft, X } from 'lucide-react' import Image from 'next/image' import { useRouter } from 'next/router' import { useState } from 'react' import SVG from 'react-inlinesvg' import { Button } from 'ui' import { ASSISTANT_SUGGESTIONS } from './HelpPanel.constants' import { HelpSection } from './HelpSection' import type { SupportFormUrlKeys } from '@/components/interfaces/Support/SupportForm.utils' import { SupportForm, SupportFormStatusButton, } from '@/components/interfaces/Support/SupportSidebarForm' import { SIDEBAR_KEYS } from '@/components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider' import { ButtonTooltip } from '@/components/ui/ButtonTooltip' import { useAiAssistantStateSnapshot } from '@/state/ai-assistant-state' import { useSidebarManagerSnapshot } from '@/state/sidebar-manager-state' export const HelpPanel = ({ onClose, projectRef, supportLinkQueryParams, }: { onClose: () => void projectRef: string | undefined supportLinkQueryParams: Partial | undefined }) => { const snap = useAiAssistantStateSnapshot() const { openSidebar, closeSidebar } = useSidebarManagerSnapshot() const router = useRouter() const [view, setView] = useState<'home' | 'support'>('home') const isSupportView = view === 'support' const openAssistant = () => { onClose() openSidebar(SIDEBAR_KEYS.AI_ASSISTANT) snap.newChat(ASSISTANT_SUGGESTIONS) } return (
{isSupportView && ( setView('home')} icon={} tooltip={{ content: { side: 'bottom', text: 'Back' } }} /> )} {isSupportView ? 'Contact support' : 'Help & Support'}
closeSidebar(SIDEBAR_KEYS.HELP_PANEL)} icon={} tooltip={{ content: { side: 'bottom', text: 'Close' } }} />
{isSupportView ? ( { setView('home') }} /> ) : (
{ setView('support') return false }} />
Community support

Our Discord community can help with code-related issues. Many questions are answered in minutes.

)}
) }