// content_graph/graph_view.rs // // Full-page interactive knowledge graph via Cytoscape.js. // Follows the SSR+WASM delegation pattern used across the codebase. // // SSR: renders container div + embedded JSON data script tag. // WASM: Effect::new calls window.ContentGraph.render() after mount. use leptos::prelude::*; use super::GRAPH_JSON; // ── Entry point (delegating component) ─────────────────────────────────────── /// Full-page knowledge graph view. /// /// `node_id`: when provided, the graph centers on that node (ego view). #[component] pub fn GraphView( #[prop(optional)] node_id: Option, #[prop(default = String::from("light"))] theme: String, ) -> impl IntoView { #[cfg(not(target_arch = "wasm32"))] return view! { }; #[cfg(target_arch = "wasm32")] return view! { }; } // ── Inner (SSR) ─────────────────────────────────────────────────────────────── #[component] fn GraphViewInner( node_id: Option, theme: String, ) -> impl IntoView { let focus = node_id.unwrap_or_default(); let graph_json_safe = GRAPH_JSON.replace(" // Embedded graph data — read by the JS shim