//! jpl-website Library
//! 
//! Core application components and functionality.

use leptos::*;
use rustelo_core::prelude::*;
use rustelo_web::prelude::*;

pub mod components;
pub mod pages;

use components::*;
use pages::*;

/// Main application component
#[component]
pub fn App() -> impl IntoView {
    // Provide global application state
    provide_meta_context();
    
    view! {
        <Html lang="en" />
        <Title text="jpl-website" />
        <Meta name="description" content="{{description}}" />
        <Meta charset="utf-8" />
        <Meta name="viewport" content="width=device-width, initial-scale=1" />
        
        // Global styles
        <Link rel="stylesheet" href="/styles/unocss.css" />
        <Link rel="icon" type="image/x-icon" href="/favicon.ico" />
        
        <Body class="bg-gray-50 text-gray-900" />
        
        <Router>
            <Navigation />
            <main class="min-h-screen">
                <Routes>
                    <Route path="/" view=Home />
                    <Route path="/about" view=About />
                    <Route path="/blog" view=BlogList />
                    <Route path="/blog/:slug" view=BlogPost />
                    <Route path="/*any" view=NotFound />
                </Routes>
            </main>
            <Footer />
        </Router>
    }
}

/// 404 Not Found page
#[component]
fn NotFound() -> impl IntoView {
    view! {
        <div class="rustelo-container rustelo-section text-center">
            <h1 class="text-4xl font-bold text-gray-900 mb-4">
                "404 - Page Not Found"
            </h1>
            <p class="text-xl text-gray-600 mb-8">
                "The page you're looking for doesn't exist."
            </p>
            <a href="/" class="btn-primary">
                "Go Home"
            </a>
        </div>
    }
}