"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from "@/components/sections/blog/BlogCardThree";
import FooterLogoReveal from "@/components/sections/footer/FooterLogoReveal";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleFullscreen from "@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen";
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="bounce-effect"
            defaultTextAnimation="entrance-slide"
            borderRadius="rounded"
            contentWidth="mediumLarge"
            sizing="mediumLargeSizeMediumTitles"
            background="none"
            cardStyle="solid"
            primaryButtonStyle="flat"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="Nexus"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Features", id: "features" },
                            { name: "Team", id: "team" },
                            { name: "Investors", id: "investors" },
                            { name: "Contact", id: "contact" },
                            { name: "Careers", id: "careers" }
                        ]}
                        bottomLeftText="San Francisco, CA"
                        bottomRightText="hello@nexus.io"
                    />
                </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="Latest Insights"
                            description="Explore our newest articles and insights from the team"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoReveal
                        logoText="Nexus"
                        leftLink={{
                            text: "Privacy Policy",                            href: "/privacy"
                        }}
                        rightLink={{
                            text: "Terms of Service",                            href: "/terms"
                        }}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}