"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBase from '@/components/sections/footer/FooterBase';
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="directional-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="medium"
            sizing="mediumLarge"
            background="floatingGradient"
            cardStyle="gradient-bordered"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="ProfileHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Explore", id: "explore" },
                            { name: "Messages", id: "messages" },
                            { name: "Settings", id: "settings" },
                            { name: "Profile", id: "profile" }
                        ]}
                    />
                </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">
                        <BlogCardThree
                            blogs={posts}
                            title="Featured Articles"
                            description="Explore our latest insights and stories from the ProfileHub community"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="ProfileHub"
                        copyrightText="© 2025 ProfileHub. All rights reserved."
                        columns={[
                            {
                                title: "Platform",                                items: [
                                    { label: "Explore", href: "explore" },
                                    { label: "Trending", href: "trending" },
                                    { label: "Discover", href: "discover" }
                                ]
                            },
                            {
                                title: "Account",                                items: [
                                    { label: "Profile", href: "profile" },
                                    { label: "Settings", href: "settings" },
                                    { label: "Saved", href: "saved" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Help Center", href: "help" },
                                    { label: "Contact Us", href: "contact" },
                                    { label: "Community", href: "community" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}