import { motion } from 'framer-motion'; import { useGeneration } from '@/context/GenerationContext'; import { XIcon, RefreshIcon, ArrowLeftIcon } from './Icons'; export const ErrorDisplay: React.FC = () => { const { state, reset, setStep } = useGeneration(); const { error, generatedVideos, segments } = state; const isCancelled = error?.toLowerCase().includes('cancelled') ?? false; const hasPartialVideos = generatedVideos.length > 0; const hasPartialPrompts = segments.length > 0 && !hasPartialVideos; return (
{/* Error Icon */} {/* Title: Cancelled vs Failed */}

{isCancelled ? 'Generation Cancelled' : 'Generation Failed'}

{error || 'An unexpected error occurred during video generation.'}

{/* Partial results when user cancelled */} {(isCancelled && (hasPartialVideos || hasPartialPrompts)) && (

Stopped with partial results

{hasPartialVideos && (

{generatedVideos.length} video segment{generatedVideos.length === 1 ? '' : 's'} generated.

)} {hasPartialPrompts && (

{segments.length} segment prompt{segments.length === 1 ? '' : 's'} generated (no videos yet).

)}
)} {/* Actions */}
{/* Help Text */}

Troubleshooting Tips

  • • Check that your API keys are properly configured
  • • Ensure your image is under 10MB and in JPG/PNG format
  • • Try a shorter script if timeouts occur
  • • Check the backend server logs for more details
); };