"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterSimple from '@/components/sections/footer/FooterSimple';
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="background-highlight"
            borderRadius="soft"
            contentWidth="compact"
            sizing="largeSmall"
            background="floatingGradient"
            cardStyle="gradient-bordered"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="SocialHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Profile", id: "profile" },
                            { name: "Feed", id: "feed" },
                            { name: "Messages", id: "messages" },
                            { name: "Notifications", id: "notifications" },
                            { name: "Settings", id: "settings" }
                        ]}
                        button={{ text: "Follow", href: "#" }}
                    />
                </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 updates from the SocialHub community"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Navigate",                                items: [
                                    { label: "Home", href: "#" },
                                    { label: "Profile", href: "#" },
                                    { label: "Messages", href: "#" }
                                ]
                            },
                            {
                                title: "Community",                                items: [
                                    { label: "Trending", href: "#" },
                                    { label: "Discover", href: "#" },
                                    { label: "Events", href: "#" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Help Center", href: "#" },
                                    { label: "Contact Us", href: "#" },
                                    { label: "FAQ", href: "#" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy", href: "#" },
                                    { label: "Terms", href: "#" },
                                    { label: "Cookies", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 SocialHub. All rights reserved."
                        bottomRightText="Made with passion"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}