import { Activity, BookOpen, HelpCircle, Mail, Wrench } from 'lucide-react' import Image from 'next/legacy/image' import { useRouter } from 'next/router' import { useState } from 'react' import SVG from 'react-inlinesvg' import { IS_PLATFORM } from 'common' import type { SupportFormUrlKeys } from 'components/interfaces/Support/SupportForm.utils' import { SupportLink } from 'components/interfaces/Support/SupportLink' import { SIDEBAR_KEYS } from 'components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider' import { ButtonTooltip } from 'components/ui/ButtonTooltip' import { useSendEventMutation } from 'data/telemetry/send-event-mutation' import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization' import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' import { DOCS_URL } from 'lib/constants' import { useAiAssistantStateSnapshot } from 'state/ai-assistant-state' import { useSidebarManagerSnapshot } from 'state/sidebar-manager-state' import { AiIconAnimation, Button, ButtonGroup, ButtonGroupItem, cn, Popover, Popover_Shadcn_, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_, } from 'ui' export const HelpPopover = () => { const router = useRouter() const { data: project } = useSelectedProjectQuery() const { data: org } = useSelectedOrganizationQuery() const snap = useAiAssistantStateSnapshot() const { openSidebar } = useSidebarManagerSnapshot() const { mutate: sendEvent } = useSendEventMutation() const [isOpen, setIsOpen] = useState(false) const projectRef = project?.parent_project_ref ?? (router.query.ref as string | undefined) let supportLinkQueryParams: Partial | undefined = undefined if (projectRef) { supportLinkQueryParams = { projectRef } } else if (org?.slug) { supportLinkQueryParams = { orgSlug: org.slug } } return ( { sendEvent({ action: 'help_button_clicked', groups: { project: project?.ref, organization: org?.slug }, }) }} tooltip={{ content: { side: 'bottom', text: 'Help' } }} >
Need help with your project?

Start with our {projectRef ? 'Assistant, docs,' : 'docs'} or community.

{projectRef && ( } onClick={() => { openSidebar(SIDEBAR_KEYS.AI_ASSISTANT) snap.newChat({ name: 'Support', initialInput: `I need help with my project`, suggestions: { title: 'I can help you with your project, here are some example prompts to get you started:', prompts: [ { label: 'Database Health', description: 'Summarise my database health and performance', }, { label: 'Debug Logs', description: 'View and debug my edge function logs', }, { label: 'RLS Setup', description: 'Implement row level security for my tables', }, ], }, }) }} > Supabase Assistant )} } asChild> Docs } asChild> Troubleshooting {IS_PLATFORM && ( <> } > Supabase status }> setIsOpen(false)} > Contact support )}
Community support

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

) }