"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterCard from '@/components/sections/footer/FooterCard';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered';
import { useBlogPosts } from "@/hooks/useBlogPosts";
import { Facebook, Twitter, Instagram, Youtube } from 'lucide-react';

export default function BlogPage() {
    const { posts, isLoading } = useBlogPosts();

    return (
        <ThemeProvider
            defaultButtonVariant="text-stagger"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="medium"
            sizing="largeSmall"
            background="floatingGradient"
            cardStyle="elevated"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Clash of Clans"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Features", id: "features" },
                            { name: "Gameplay", id: "gameplay" },
                            { name: "Community", id: "community" },
                            { name: "FAQ", id: "faq" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Download Now", href: "contact" }}
                    />
                </div>

                {isLoading ? (
                    <div className="w-content-width mx-auto py-20 text-center">
                        <p className="text-foreground">Loading posts...</p>
                    </div>
                ) : (
                    <div id="blog" data-section="blog">
                        <BlogCardOne
                            blogs={posts}
                            title="Clash Chronicles"
                            description="Stay updated with the latest strategies, updates, and community insights from the world of Clash of Clans"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterCard
                        logoText="Clash of Clans"
                        copyrightText="© 2025 Supercell. All rights reserved. | Clash of Clans - Strategy Game"
                        socialLinks={[
                            { icon: Facebook, href: "https://facebook.com/clashofclans", ariaLabel: "Clash of Clans on Facebook" },
                            { icon: Twitter, href: "https://twitter.com/clashofclans", ariaLabel: "Clash of Clans on Twitter" },
                            { icon: Instagram, href: "https://instagram.com/clashofclans", ariaLabel: "Clash of Clans on Instagram" },
                            { icon: Youtube, href: "https://youtube.com/@ClashOfClans", ariaLabel: "Clash of Clans on YouTube" }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}