'use client' import { ExternalLink } from 'lucide-react' import { useState } from 'react' import { AccordionContent, AccordionItem, AccordionTrigger, Button } from 'ui' import { RestartProjectDialog } from './RestartProjectDialog' import { AiAssistantDropdown } from '@/components/ui/AiAssistantDropdown' import { useTrack } from '@/lib/telemetry/track' interface StepTriggerProps { number: number title: string } function StepTrigger({ number, title }: StepTriggerProps) { return (
{number} {title}
) } interface RestartDatabaseTroubleshootingSectionProps { number: number errorType: string /** Override the restart handler. If not provided, opens the restart dialog internally. */ onRestartProject?: () => void } export function RestartDatabaseTroubleshootingSection({ number, errorType, onRestartProject, }: RestartDatabaseTroubleshootingSectionProps) { const track = useTrack() const [showDialog, setShowDialog] = useState(false) const handleClick = () => { track('inline_error_troubleshooter_action_clicked', { errorType, ctaType: 'restart_db', }) if (onRestartProject) { onRestartProject() } else { setShowDialog(true) } } return ( <>

Restarting your project can help resolve timeout errors or stale connections.

setShowDialog(false)} restartType="database" /> ) } interface TroubleshootingGuideSectionProps { number: number errorType: string href: string title?: string description?: string } export function TroubleshootingGuideSection({ number, errorType, href, title = 'Try our troubleshooting guide', description, }: TroubleshootingGuideSectionProps) { const track = useTrack() return (
{description &&

{description}

}
) } interface FixWithAITroubleshootingSectionProps { number: number errorType: string description?: string onDebugWithAI?: (prompt: string) => void buildPrompt: () => string } export function FixWithAITroubleshootingSection({ number, errorType, description = 'Let our AI assistant help diagnose and suggest solutions.', onDebugWithAI, buildPrompt, }: FixWithAITroubleshootingSectionProps) { const track = useTrack() return (

{description}

{ track('inline_error_troubleshooter_action_clicked', { errorType, ctaType: 'ask_ai', }) onDebugWithAI?.(buildPrompt()) }} size="tiny" />
) }