mod app;
use cfg_if::cfg_if;

cfg_if! {
    if #[cfg(feature = "hydrate")] {
        use wasm_bindgen::prelude::wasm_bindgen;
        use crate::app::*;
        use leptos::*;

        #[wasm_bindgen]
        pub fn hydrate() {
            _ = console_log::init_with_level(log::Level::Debug);
            console_error_panic_hook::set_once();

            log::info!("hydrate mode - hydrating");
            log::info!("Portfolio version : {}", env!("CARGO_PKG_VERSION"));

            mount_to_body(|| {
                view! { <App/> }
            });
        }
    }
    else if #[cfg(feature = "csr")] {
        use wasm_bindgen::prelude::wasm_bindgen;

        #[wasm_bindgen(start)]
        pub fn main() {
            use app::*;
            use leptos::*;
            _ = console_log::init_with_level(log::Level::Debug);
            console_error_panic_hook::set_once();

            log::info!("csr mode - mounting to body");
            log::info!("Portfolio version : {}", env!("CARGO_PKG_VERSION"));

            mount_to_body(|| {
                view! { <App /> }
            });
        }
    }
}