"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-magnetic"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="small"
            sizing="medium"
            background="aurora"
            cardStyle="outline"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="SnapCircle"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Stories", id: "stories" },
                            { name: "Posts", id: "feed" },
                            { name: "Stats", id: "metrics" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{
                            text: "Follow",                            onClick: () => console.log('Follow clicked')
                        }}
                    />
                </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 the creative moments and adventures from our community"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Navigate",                                items: [
                                    { label: "Home", href: "#hero" },
                                    { label: "Stories", href: "#stories" },
                                    { label: "Feed", href: "#feed" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Twitter", href: "https://twitter.com" },
                                    { label: "TikTok", href: "https://tiktok.com" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "About", href: "#" },
                                    { label: "Contact", href: "#contact" },
                                    { label: "Privacy", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 SnapCircle. All rights reserved."
                        bottomRightText="Made with creativity and passion"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}