"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from '@/components/sections/blog/BlogCardOne';
import FooterMedia from '@/components/sections/footer/FooterMedia';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="slide-background"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="mediumSmall"
            sizing="large"
            background="none"
            cardStyle="solid"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="Clash of Clans"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Features", id: "features" },
                            { name: "Gameplay", id: "gameplay" },
                            { name: "Community", id: "testimonials" },
                            { name: "Download", id: "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="Battle Chronicles"
                            description="Latest news, strategies, and epic moments from the world of Clash of Clans"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/portrait-scandinavian-female-viking-person_23-2151707039.jpg"
                        imageAlt="Clash of Clans epic battle scene"
                        logoText="Clash of Clans"
                        copyrightText="© 2024 Supercell | Clash of Clans Official"
                        columns={[
                            {
                                title: "Game",                                items: [
                                    { label: "Download", href: "#contact" },
                                    { label: "Features", href: "#features" },
                                    { label: "Gameplay", href: "#gameplay" }
                                ]
                            },
                            {
                                title: "Community",                                items: [
                                    { label: "Join a Clan", href: "https://supercell.com" },
                                    { label: "Global Rankings", href: "https://supercell.com" },
                                    { label: "Events & Updates", href: "https://supercell.com" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Help Center", href: "https://supercell.com" },
                                    { label: "Contact Us", href: "https://supercell.com" },
                                    { label: "Privacy Policy", href: "https://supercell.com" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}