"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from "@/components/sections/blog/BlogCardTwo";
import FooterBase from "@/components/sections/footer/FooterBase";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingOverlay from "@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay";
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="expand-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="medium"
            sizing="large"
            background="circleGradient"
            cardStyle="gradient-radial"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Clash of Clans"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Features", id: "features" },
                            { name: "Community", id: "testimonials" },
                            { name: "Stats", id: "metrics" },
                            { name: "Download", id: "contact" }
                        ]}
                        button={{
                            text: "Play Now",                            href: "https://supercell.com/en/games/clashofclans/"
                        }}
                    />
                </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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Clash Chronicles"
                            description="Latest strategies, updates, and insights from the world of Clash of Clans"
                            tag="Battle Updates"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="Clash of Clans"
                        copyrightText="© 2025 Supercell. All rights reserved."
                        columns={[
                            {
                                title: "Game",                                items: [
                                    { label: "Download", href: "https://supercell.com/en/games/clashofclans/" },
                                    { label: "Features", href: "#features" },
                                    { label: "Updates", href: "https://supercell.com/en/games/clashofclans/" },
                                    { label: "Clans", href: "#community" }
                                ]
                            },
                            {
                                title: "Community",                                items: [
                                    { label: "Forums", href: "https://supercell.com/en/games/clashofclans/" },
                                    { label: "Tournaments", href: "https://supercell.com/en/games/clashofclans/" },
                                    { label: "Support", href: "https://supercell.com/en/games/clashofclans/" },
                                    { label: "Social", href: "https://supercell.com/en/games/clashofclans/" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "https://supercell.com/en/games/clashofclans/" },
                                    { label: "Terms of Service", href: "https://supercell.com/en/games/clashofclans/" },
                                    { label: "Contact Us", href: "https://supercell.com/en/games/clashofclans/" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}