"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterMedia from '@/components/sections/footer/FooterMedia';
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="expand-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="mediumSmall"
            sizing="largeSmallSizeLargeTitles"
            background="floatingGradient"
            cardStyle="gradient-bordered"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="SocialHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Profile", id: "profile" },
                            { name: "Feed", id: "feed" },
                            { name: "Messages", id: "messages" },
                            { name: "Settings", id: "settings" },
                            { name: "Explore", id: "explore" }
                        ]}
                        button={{ text: "Follow", href: "contact" }}
                    />
                </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 Updates"
                            description="Discover stories and insights from our community"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/close-up-portrait-curly-handsome-european-male_176532-8133.jpg"
                        imageAlt="Profile footer image"
                        columns={[
                            {
                                title: "Profile",                                items: [
                                    { label: "About", href: "#profile" },
                                    { label: "Posts", href: "#feed" },
                                    { label: "Stories", href: "#stories" },
                                    { label: "Saved", href: "#" }
                                ]
                            },
                            {
                                title: "Social",                                items: [
                                    { label: "Instagram", href: "#" },
                                    { label: "Twitter", href: "#" },
                                    { label: "LinkedIn", href: "#" },
                                    { label: "Pinterest", href: "#" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Blog", href: "#" },
                                    { label: "Portfolio", href: "#" },
                                    { label: "Contact", href: "#contact" },
                                    { label: "FAQ", href: "#" }
                                ]
                            }
                        ]}
                        logoText="SocialHub"
                        copyrightText="© 2025 SocialHub. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}