import React, { Suspense } from 'react'; import Link from 'next/link'; import { fetchAnimeInfo } from '@/lib/api'; import AnimeDetails from '@/components/AnimeDetails.js'; // Loading state component const LoadingState = () => (
{/* Background Placeholder */}
{/* Content Placeholder */}
{/* Poster Placeholder */}
{/* Details Placeholder */}
); // Error state component const ErrorState = ({ error }) => (

Error Loading Anime

{error}

Go Back Home
); // Not found state component const NotFoundState = () => (

Anime Not Found

The anime you're looking for doesn't exist or was removed.

Go Back Home
); // Main anime content component const AnimeContent = async ({ id }) => { try { console.log('[AnimeInfo] Fetching info for ID:', id); const anime = await fetchAnimeInfo(id); console.log('[AnimeInfo] API Response received:', anime ? 'success' : 'empty'); if (!anime || !anime.info) { console.error('[AnimeInfo] Missing required anime data'); return ; } return (
); } catch (error) { console.error('[AnimeInfo] Error:', error.message); return ; } }; // Main page component with Suspense export default function AnimeInfoPage({ params }) { const { id } = params; return ( }> ); }