diff --git a/Cargo.toml b/Cargo.toml
index 0ac335d..ec3f35a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,4 +10,4 @@ chrono = { version = "0.4", features = ["serde"] }
leptos = { version = "0.7", features = ["csr"] }
console_error_panic_hook = "0.1.7"
serde = { version = "1.0", features = ["derive"] }
-gloo-net = "0.6.0"
+gloo-timers = { version = "0.3", features = ["futures"] }
diff --git a/config.json b/config.json
deleted file mode 100644
index 758ef09..0000000
--- a/config.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "motd": "Hello world!"
-}
\ No newline at end of file
diff --git a/index.html b/index.html
index 4f65528..105d24a 100644
--- a/index.html
+++ b/index.html
@@ -2,7 +2,12 @@
Band Sessions
-
+
+
diff --git a/session_config.json b/session_config.json
new file mode 100644
index 0000000..a5d454c
--- /dev/null
+++ b/session_config.json
@@ -0,0 +1,3 @@
+{
+ "motd": "Proben Sonntags um 10:00 Uhr und Dienstags um 18:30 Uhr"
+}
\ No newline at end of file
diff --git a/src/webpage.rs b/src/webpage.rs
index fbde05c..c7f479f 100644
--- a/src/webpage.rs
+++ b/src/webpage.rs
@@ -3,33 +3,51 @@ use leptos::server_fn::request::browser::Request;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct Config {
+pub struct SessionConfig {
pub motd: String,
}
#[component]
pub fn App() -> impl IntoView {
- let (count, set_count) = signal(0);
- let config = LocalResource::new(load_config);
+ let session_config = LocalResource::new(load_config);
+
+ let session_dates = move || {
+ session_config
+ .get()
+ .as_deref()
+ .cloned()
+ .map(|config| match config {
+ Ok(config) => view! { }.into_any(),
+ Err(e) => {
+ view! { {format!("Failed to load Sessions config: {e}")}
}.into_any()
+ }
+ })
+ };
view! {
-
-
"Anstehende Proben Termine"
-
"TODO motd"
-
-
+
{session_dates}
}
}
-async fn load_config() -> std::result::Result {
- let response = Request::get("/config.json")
+#[component]
+fn Sessions(config: SessionConfig) -> impl IntoView {
+ view! {
+
+
"Anstehende Proben Termine"
+
{config.motd}
+
+ }
+}
+
+async fn load_config() -> Result {
+ let response = Request::get("/session_config.json")
.send()
.await
.map_err(|e| format!("HTTP error: {e}"))?;
let config = response
- .json::()
+ .json::()
.await
.map_err(|e| format!("JSON error: {e}"))?;
Ok(config)