'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' import { useTranslation } from '@/lib/hooks/use-translation' interface ConnectionErrorOverlayProps { error: ConnectionError onRetry: () => void } export function ConnectionErrorOverlay({ error, onRetry, }: ConnectionErrorOverlayProps) { const { t } = useTranslation() const [showDetails, setShowDetails] = useState(false) const isApiError = error.type === 'api-unreachable' return (
{isApiError ? t('connectionErrors.apiDesc') : t('connectionErrors.dbDesc')}
{t('connectionErrors.setApiUrl')}
# {t('connectionErrors.dockerLabel')}:
docker run -e API_URL=http://your-host:5055 ...
# {t('connectionErrors.localDevLabel')}:
API_URL=http://localhost:5055
{t('connectionErrors.checkSurreal')}
# {t('connectionErrors.dockerLabel')}:
docker compose ps | grep surrealdb
docker compose logs surrealdb
{t('connectionErrors.seeDocumentation')}
{t('connectionErrors.docLink')}
{error.details.stack}
{t('connectionErrors.retryHint')}