"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 NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-stagger"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="compact"
            sizing="medium"
            background="none"
            cardStyle="gradient-radial"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Dashboard", id: "dashboard" },
                            { name: "Analytics", id: "analytics" },
                            { name: "Reports", id: "reports" },
                            { name: "Settings", id: "settings" },
                            { name: "Support", id: "support" }
                        ]}
                        brandName="Dashboard"
                        bottomLeftText="Admin Panel"
                        bottomRightText="dashboard@company.com"
                    />
                </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="Latest Articles"
                            description="Stay updated with our latest insights and industry trends"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        logoText="Dashboard"
                        columns={[
                            {
                                items: [
                                    { label: "Home", href: "#" },
                                    { label: "Analytics", href: "#analytics" },
                                    { label: "Reports", href: "#" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Settings", href: "#settings" },
                                    { label: "Profile", href: "#" },
                                    { label: "Preferences", href: "#" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Documentation", href: "#" },
                                    { label: "Support", href: "#support" },
                                    { label: "Contact", href: "#" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms of Service", href: "#" },
                                    { label: "Sitemap", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}