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

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="small"
            sizing="largeSmallSizeLargeTitles"
            background="none"
            cardStyle="glass-depth"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="glass"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="SocialHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Explore", id: "explore" },
                            { name: "Messages", id: "messages" },
                            { name: "Notifications", id: "notifications" },
                            { name: "Profile", id: "profile" }
                        ]}
                        button={{ text: "Share Post", href: "create" }}
                    />
                </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 Social Updates"
                            description="Discover trending content and insights from our community"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Platform",                                items: [
                                    { label: "Home", href: "home" },
                                    { label: "Explore", href: "explore" },
                                    { label: "Messages", href: "messages" },
                                    { label: "Notifications", href: "notifications" }
                                ]
                            },
                            {
                                title: "Community",                                items: [
                                    { label: "Browse Profiles", href: "#" },
                                    { label: "Discover Content", href: "#" },
                                    { label: "Trending Topics", href: "#" },
                                    { label: "Recommendations", href: "#" }
                                ]
                            },
                            {
                                title: "Account",                                items: [
                                    { label: "Settings", href: "#" },
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms of Service", href: "#" },
                                    { label: "Contact Support", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 SocialHub | Connecting People Worldwide"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}