use leptos::prelude::*;

/// Root application component for the WASM client.
///
/// Must render the same DOM structure as the server template's `AppComponent`
/// so Leptos hydration can match nodes without cursor desync.
///
/// The `path` prop carries the initial URL path detected from `window.location`.
#[component]
pub fn AppComponent(#[prop(default = String::new())] path: String) -> impl IntoView {
    let (current_path, set_path) = signal(path);

    view! {
        <div class="min-h-screen">
            <header>
                <nav>
                    <a href="/">"Home"</a>
                </nav>
            </header>
            <main>
                <p>"Path: " {move || current_path.get()}</p>
            </main>
        </div>
    }
}
