"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterLogoEmphasis from '@/components/sections/footer/FooterLogoEmphasis';
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="icon-arrow"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="small"
            sizing="mediumSizeLargeTitles"
            background="none"
            cardStyle="glass-elevated"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="Clash of Clans"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Features", id: "features" },
                            { name: "Community", id: "testimonials" },
                            { name: "Download", id: "hero" },
                            { name: "FAQ", id: "faq" },
                            { name: "Guide", id: "about" }
                        ]}
                    />
                </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 News & Updates"
                            description="Stay updated with the latest Clash of Clans strategies, updates, and community highlights"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Strategy Hub"
                            ariaLabel="Clash of Clans Blog section"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        logoText="Clash of Clans"
                        columns={[
                            {
                                items: [
                                    { label: "Home", href: "hero" },
                                    { label: "Features", href: "features" },
                                    { label: "Community", href: "testimonials" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Download iOS", href: "https://apps.apple.com/app/clash-of-clans" },
                                    { label: "Download Android", href: "https://play.google.com/store/apps/details?id=com.supercell.clashofclans" },
                                    { label: "Official Website", href: "https://clasofclans.com" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Support", href: "https://support.clasofclans.com" },
                                    { label: "Privacy Policy", href: "https://clasofclans.com/privacy" },
                                    { label: "Terms of Service", href: "https://clasofclans.com/terms" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Twitter", href: "https://twitter.com/ClashofClans" },
                                    { label: "Discord", href: "https://discord.gg/clasofclans" },
                                    { label: "YouTube", href: "https://youtube.com/@clasofclans" }
                                ]
                            }
                        ]}
                        ariaLabel="Clash of Clans Footer"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}