"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal';
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="hover-bubble"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="medium"
            sizing="medium"
            background="none"
            cardStyle="gradient-bordered"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Mind Mush"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Features", id: "features" },
                            { name: "Pricing", id: "pricing" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{
                            text: "Get Started",                            href: "https://mindmush.app"
                        }}
                    />
                </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="Mind Mush Blog"
                            description="Discover insights, tips, and strategies to enhance your mental performance and cognitive abilities."
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Product",                                items: [
                                    { label: "Features", href: "#features" },
                                    { label: "Pricing", href: "#pricing" },
                                    { label: "Changelog", href: "https://mindmush.app/changelog" },
                                    { label: "Roadmap", href: "https://mindmush.app/roadmap" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About", href: "https://mindmush.app/about" },
                                    { label: "Blog", href: "https://mindmush.app/blog" },
                                    { label: "Careers", href: "https://mindmush.app/careers" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Documentation", href: "https://docs.mindmush.app" },
                                    { label: "Community", href: "https://community.mindmush.app" },
                                    { label: "Tutorials", href: "https://mindmush.app/tutorials" },
                                    { label: "Status", href: "https://status.mindmush.app" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Mind Mush. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}