'use client' import { useState } from 'react' import { Card } from '@/components/ui/card' import { Button } from '@/components/ui/button' import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '@/components/ui/collapsible' import { Database, Server, ChevronDown, ExternalLink } from 'lucide-react' import { ConnectionError } from '@/lib/types/config' interface ConnectionErrorOverlayProps { error: ConnectionError onRetry: () => void } export function ConnectionErrorOverlay({ error, onRetry, }: ConnectionErrorOverlayProps) { const [showDetails, setShowDetails] = useState(false) const isApiError = error.type === 'api-unreachable' return (
{/* Error icon and title */}
{isApiError ? (
{/* Troubleshooting instructions */}

This usually means:

    {isApiError ? ( <>
  • The API server is not running
  • The API server is running on a different address
  • Network connectivity issues
  • ) : ( <>
  • SurrealDB is not running
  • Database connection settings are incorrect
  • Network issues between API and database
  • )}

Quick fixes:

{isApiError ? (

Set the API_URL environment variable:

# For Docker:
docker run -e API_URL=http://your-host:5055 ...

# For local development (.env file):
API_URL=http://localhost:5055
) : (

Check if SurrealDB is running:

# For Docker:
docker compose ps | grep surrealdb
docker compose logs surrealdb
)}
{/* Documentation link */}

For detailed setup instructions, see:

Open Notebook Documentation
{/* Collapsible technical details */} {error.details && (
{error.details.attemptedUrl && (
Attempted URL: {error.details.attemptedUrl}
)} {error.details.message && (
Message: {error.details.message}
)} {error.details.technicalMessage && (
Technical Details:{' '} {error.details.technicalMessage}
)} {error.details.stack && (
Stack Trace:
                      {error.details.stack}
                    
)}
)} {/* Retry button */}

Press R or click the button to retry

) }