/* eslint-disable @next/next/no-img-element -- External or generated image URLs; next/image migration is out of scope. */ import { useState, useEffect } from 'react'; import { useRouter } from 'next/router'; import Link from 'next/link'; import { useAuth } from '../lib/use-auth.js'; import AnimatedFireLogo from '../components/AnimatedFireLogo'; export default function Home() { const { user, loading } = useAuth(); const router = useRouter(); const [featuredCollections, setFeaturedCollections] = useState([]); const [collectionsLoading, setCollectionsLoading] = useState(true); // If user is logged in, redirect to dashboard useEffect(() => { if (!loading && user) { router.push('/dashboard'); } }, [user, loading, router]); // Fetch featured collections for public display useEffect(() => { const fetchFeaturedCollections = async () => { try { const response = await fetch('/api/public/collections?limit=6'); if (response.ok) { const collections = await response.json(); setFeaturedCollections(collections); } } catch (error) { console.error('Error fetching featured collections:', error); } finally { setCollectionsLoading(false); } }; fetchFeaturedCollections(); }, []); // Show loading while checking auth if (loading) { return (

Loading...

); } // If user is logged in, don't show landing page (redirect handled above) if (user) { return null; } return (
{/* Navigation Bar */} {/* Hero Section */}

Deck Hearth

The ultimate hub for trading card collectors. Organize your cards into lists, discover rare cards, and connect with fellow enthusiasts in one beautiful platform.

Start Your Collection Explore Lists
{/* Features Section */}

Everything You Need to Manage Your Cards

Organize Lists

Create custom lists, track card values, and organize by sets, rarity, or any system that works for you.

Discover Cards

Search through thousands of cards across multiple TCGs. Find that missing piece for your binder.

Connect & Share

Share your lists with the community, collaborate with friends, and discover amazing lists from other collectors.

{/* Featured Collections Section */}

Featured Lists

Discover amazing lists from our community

{collectionsLoading ? (
{[...Array(6)].map((_, i) => (
))}
) : (
{featuredCollections.map((collection) => (
{collection.image ? ( {collection.name} ) : (

{collection.cardCount} cards

)}

{collection.name}

{collection.description || 'A carefully curated list'}

{collection.cardCount} cards by {collection.creator}
))}
)}
View All Lists
{/* CTA Section */}

Ready to Start Your Journey?

Join thousands of collectors who trust Deck Hearth to manage their cards and lists.

Create Free Account Browse Cards
{/* Footer */}
); }