"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterMedia from '@/components/sections/footer/FooterMedia';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="elastic-effect"
            defaultTextAnimation="entrance-slide"
            borderRadius="rounded"
            contentWidth="compact"
            sizing="largeSmallSizeMediumTitles"
            background="aurora"
            cardStyle="solid"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="SnapProfile"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Explore", id: "explore" },
                            { name: "Messages", id: "messages" },
                            { name: "Notifications", id: "notifications" },
                            { name: "Settings", id: "settings" }
                        ]}
                        button={{ text: "Sign In", 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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Latest Stories"
                            description="Discover trending content and insights from our community"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/serious-beautiful-young-woman-stretches-arms-makes-selfie-walk-urban-setting-wears-casual-green-jumper-has-confident-look-camera-female-blogger-records-video-front-camera_273609-56681.jpg"
                        imageAlt="Social media footer background"
                        columns={[
                            {
                                title: "Navigation",                                items: [
                                    { label: "Profile", href: "#" },
                                    { label: "Posts", href: "#" },
                                    { label: "Stories", href: "#" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Instagram", href: "#" },
                                    { label: "Twitter", href: "#" },
                                    { label: "TikTok", href: "#" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Contact", href: "#" },
                                    { label: "FAQ", href: "#" },
                                    { label: "Community", href: "#" }
                                ]
                            }
                        ]}
                        logoText="SnapProfile"
                        copyrightText="© 2025 SnapProfile. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}