"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterBaseCard from "@/components/sections/footer/FooterBaseCard";
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="elastic-effect"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="medium"
            sizing="medium"
            background="floatingGradient"
            cardStyle="glass-depth"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="solid"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        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: "#" }}
                        brandName="SocialHub"
                    />
                </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 Articles"
                            description="Stay updated with our latest insights and community updates"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="SocialHub"
                        columns={[
                            {
                                title: "Platform",                                items: [
                                    { label: "Explore", href: "#explore" },
                                    { label: "Trending", href: "#trending" },
                                    { label: "Discover", href: "#discover" }
                                ]
                            },
                            {
                                title: "Community",                                items: [
                                    { label: "Guidelines", href: "#guidelines" },
                                    { label: "Support", href: "#support" },
                                    { label: "Feedback", href: "#feedback" }
                                ]
                            },
                            {
                                title: "Account",                                items: [
                                    { label: "Settings", href: "#settings" },
                                    { label: "Privacy", href: "#privacy" },
                                    { label: "Security", href: "#security" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Twitter", href: "#twitter" },
                                    { label: "Instagram", href: "#instagram" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 SocialHub. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}