//! Generated client-side {ComponentName} page component
//!
//! Auto-generated reactive implementation with i18n pattern discovery.

use leptos::prelude::*;
use shared::{
    config::get_default_language,
    i18n::{build_page_content_patterns, UnifiedI18n},
    state::use_language,
};

/// Client-side reactive {ComponentName} page component
#[component]
pub fn {ComponentName}PageClient(
    #[allow(unused_variables)]
    #[prop(default = get_default_language().to_string())]
    _language: String,
) -> impl IntoView {
    // Get language context outside the memo to ensure we track the same instance
    let language_context = use_language();

    // Create page content with reactive language tracking
    let page_content = Memo::new(move |_| {
        // Access the current language reactively - this will track the signal
        let current_language = language_context.current.get();
        // Create UnifiedI18n with the current language for reactivity
        let i18n = UnifiedI18n::new(&current_language, "/");
        build_page_content_patterns(&i18n, {patterns})
    });

    move || {
        view! {
            <crate::{ModuleName}::unified::Unified{ComponentName}Page lang_content=page_content.get() />
        }
    }
}
