diff --git a/application/src/components/header.rs b/application/src/components/header.rs index e8291e1..41bbe7e 100644 --- a/application/src/components/header.rs +++ b/application/src/components/header.rs @@ -1,15 +1,17 @@ use leptos::*; use leptos_router::*; +use leptos_use::core::ConnectionReadyState; /// Renders the home page of your application. #[component] pub fn Header() -> impl IntoView { + let ready_state = use_context::>(); // Creates a reactive value to update the button view! {
"WRB Timings" -
Connection: ???
+
"Connection: " { move || format!("{}", ready_state.unwrap().get()) }
} diff --git a/application/src/pages/add_time.rs b/application/src/pages/add_time.rs index 03433ea..acbb404 100644 --- a/application/src/pages/add_time.rs +++ b/application/src/pages/add_time.rs @@ -1,6 +1,5 @@ use crate::util::surrealdb::schemas; use leptos::{ev::keydown, *}; -use leptos_router::{ActionForm, FromFormData}; use leptos_use::*; use strsim::normalized_damerau_levenshtein; use web_sys::ScrollIntoViewOptions; diff --git a/application/src/util/websocket/client.rs b/application/src/util/websocket/client.rs index b27544e..7b0bb28 100644 --- a/application/src/util/websocket/client.rs +++ b/application/src/util/websocket/client.rs @@ -11,6 +11,8 @@ pub fn init_websocket() { .. } = use_websocket("ws://localhost:3000/ws"); + provide_context(ready_state); + create_effect(move |prev_value| { let msg = message.get();