"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="bounce-effect"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="mediumSmall"
            sizing="largeSmallSizeLargeTitles"
            background="aurora"
            cardStyle="soft-shadow"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="solid"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="SocialHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Feed", id: "posts" },
                            { name: "Stories", id: "stories" },
                            { name: "Messages", id: "messages" },
                            { name: "Notifications", id: "notifications" },
                            { name: "Settings", id: "settings" }
                        ]}
                        button={{ text: "Create Post", href: "posts" }}
                    />
                </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="SocialHub Stories"
                            description="Discover trending stories and updates from our community"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="SocialHub"
                        columns={[
                            {
                                title: "Platform",                                items: [
                                    { label: "Feed", href: "#posts" },
                                    { label: "Stories", href: "#stories" },
                                    { label: "Messages", href: "#messages" },
                                    { label: "Explore", href: "#explore" }
                                ]
                            },
                            {
                                title: "Community",                                items: [
                                    { label: "Creators", href: "#creators" },
                                    { label: "Trends", href: "#trends" },
                                    { label: "Events", href: "#events" },
                                    { label: "Support", href: "#support" }
                                ]
                            },
                            {
                                title: "Account",                                items: [
                                    { label: "Settings", href: "#settings" },
                                    { label: "Privacy", href: "#privacy" },
                                    { label: "Security", href: "#security" },
                                    { label: "Help", href: "#help" }
                                ]
                            },
                            {
                                title: "Follow Us",                                items: [
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Twitter", href: "https://twitter.com" },
                                    { label: "TikTok", href: "https://tiktok.com" },
                                    { label: "YouTube", href: "https://youtube.com" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 SocialHub. All rights reserved."
                        onPrivacyClick={null}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}