"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterBaseCard from "@/components/sections/footer/FooterBaseCard";
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="hover-bubble"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="medium"
            sizing="medium"
            background="none"
            cardStyle="gradient-bordered"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="solid"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Clash of Clans"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Features", id: "features" },
                            { name: "Game Modes", id: "gamemodes" },
                            { name: "Community", id: "community" },
                            { name: "FAQ", id: "faq" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{
                            text: "Download Now",                            href: "https://play.google.com/store/apps/details?id=com.supercell.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">
                        <BlogCardOne
                            blogs={posts}
                            title="Clash Chronicles"
                            description="Stay updated with the latest strategies, updates, and community highlights from the world of Clash of Clans"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="Clash of Clans"
                        columns={[
                            {
                                title: "Game",                                items: [
                                    { label: "Download", href: "https://play.google.com/store/apps/details?id=com.supercell.clashofclans" },
                                    { label: "Features", href: "#features" },
                                    { label: "Game Modes", href: "#gamemodes" },
                                    { label: "Community", href: "#community" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "FAQ", href: "#faq" },
                                    { label: "Contact Us", href: "#contact" },
                                    { label: "Bug Reports", href: "https://supercell.com/en/support/" },
                                    { label: "Help Center", href: "https://help.supercellgames.com/" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Supercell", href: "https://supercell.com/" },
                                    { label: "Blog", href: "https://supercell.com/en/blog/" },
                                    { label: "Careers", href: "https://supercell.com/en/careers/" },
                                    { label: "Press", href: "https://supercell.com/en/press/" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "#privacy" },
                                    { label: "Terms of Service", href: "#terms" },
                                    { label: "Cookie Policy", href: "#cookies" },
                                    { label: "Content Policy", href: "#content" }
                                ]
                            }
                        ]}
                        copyrightText="© 2024 Supercell. All rights reserved. Clash of Clans is a trademark of Supercell."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}