//! Syntaxis Dashboard - Client-Side Rendered Frontend
//!
//! This crate provides the Leptos-based WASM frontend for the Syntaxis Dashboard.
//! It uses Client-Side Rendering (CSR) for maximum interactivity and real-time updates.
//!
//! # Architecture
//!
//! - **Components**: Reusable UI components (header, footer, loading, error boundaries)
//! - **Pages**: Route-specific page components
//! - **State**: Application-wide state management using Leptos signals
//!
//! # Usage
//!
//! This crate is compiled to WASM and loaded by the browser. The entry point is the `hydrate()`
//! function which mounts the app to the DOM.

#![forbid(unsafe_code)]
#![warn(missing_docs)]

use leptos::prelude::*;
use wasm_bindgen::prelude::*;

mod app;
mod components;
mod config;
mod pages;
mod state;

pub use app::App;
pub use config::{get_api_base_url, get_api_path, get_api_url};

/// Main entry point for the WASM application
///
/// This function is called from JavaScript to initialize the Leptos app.
/// It sets up panic hooks for better error reporting and mounts the root
/// component to the document body.
///
/// # Panics
///
/// Will panic if the app cannot be mounted to the body element.
#[wasm_bindgen]
pub fn hydrate() {
    // Set up better panic messages in the browser console
    console_error_panic_hook::set_once();

    // Mount the app to the body
    mount_to_body(|| {
        view! {
            <App/>
        }
    });
}
