// SPDX-License-Identifier: Apache-2.0
//! hejpics web frontend (Leptos 0.8, SSR + Hydrate mockup).
//!
//! This crate is compiled twice by cargo-leptos:
//!   - `--features ssr`     → native server binary  (main.rs)
//!   - `--features hydrate` → wasm32 hydration bundle (this entry below)

#![allow(clippy::needless_pass_by_value)]
#![allow(clippy::wildcard_imports)]

pub mod app;
pub mod components;
pub mod i18n;
pub mod mock;
pub mod pages;
pub mod state;

pub use app::App;

// ── Hydrate entry (browser only) ─────────────────────────────────────────────
//
// Compiled only for the wasm32 target. `#[wasm_bindgen(start)]` makes this
// the Wasm module entry point. It hydrates the server-rendered HTML so the
// Leptos reactive tree takes over without a visible repaint.

#[cfg(target_arch = "wasm32")]
mod hydrate_entry {
    use super::App;
    use wasm_bindgen::prelude::wasm_bindgen;

    #[wasm_bindgen(start)]
    pub fn hydrate() {
        use log::Level;
        console_error_panic_hook::set_once();
        let _ = console_log::init_with_level(Level::Info);
        leptos::mount::hydrate_body(App);
    }
}
