use leptos::prelude::*;
use lodviz_core::core::selection::Selection;
#[derive(Debug, Clone, Copy)]
pub struct DashboardContext {
pub hover_x: RwSignal<Option<f64>>,
pub selection: RwSignal<Option<Selection>>,
}
impl DashboardContext {
pub fn new() -> Self {
Self {
hover_x: RwSignal::new(None),
selection: RwSignal::new(None),
}
}
}
impl Default for DashboardContext {
fn default() -> Self {
Self::new()
}
}
#[component]
pub fn LinkedDashboard(children: Children) -> impl IntoView {
let ctx = DashboardContext::new();
provide_context(ctx);
children()
}