Initial work on the actual maps for the heatmap overview

This commit is contained in:
Lol3rrr
2024-10-05 05:18:28 +02:00
parent ae85177697
commit f7273b5a39
15 changed files with 228 additions and 55 deletions

View File

@@ -3,11 +3,17 @@ use leptos_router::{Outlet, A};
pub mod heatmap;
#[derive(Debug, Clone)]
struct CurrentDemoName(ReadSignal<String>);
#[leptos::component]
pub fn demo() -> impl leptos::IntoView {
let params = leptos_router::use_params_map();
let id = move || params.with(|params| params.get("id").cloned().unwrap_or_default());
let (rx, map_tx) = create_signal(String::new());
provide_context(CurrentDemoName(rx.clone()));
let demo_info = create_resource(
|| (),
move |_| async move {
@@ -15,7 +21,11 @@ pub fn demo() -> impl leptos::IntoView {
.send()
.await
.unwrap();
res.json::<common::DemoInfo>().await.unwrap()
let value = res.json::<common::DemoInfo>().await.unwrap();
map_tx.set(value.map.clone());
value
},
);