"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from '@/components/sections/blog/BlogCardOne';
import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal';
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="text-stagger"
            defaultTextAnimation="reveal-blur"
            borderRadius="sharp"
            contentWidth="smallMedium"
            sizing="largeSmall"
            background="circleGradient"
            cardStyle="gradient-radial"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="glass"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Dashboard", id: "hero" },
                            { name: "Analytics", id: "#" },
                            { name: "Reports", id: "#" },
                            { name: "Settings", id: "#" }
                        ]}
                        brandName="DashBoard"
                    />
                </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="Latest Insights"
                            description="Discover actionable insights and best practices from our analytics experts"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Product",                                items: [
                                    { label: "Features", href: "#" },
                                    { label: "Pricing", href: "#" },
                                    { label: "Dashboard", href: "hero" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About", href: "#" },
                                    { label: "Blog", href: "#" },
                                    { label: "Careers", href: "#" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Documentation", href: "#" },
                                    { label: "API Docs", href: "#" },
                                    { label: "Support", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 DashBoard Analytics. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}