diff --git a/Cargo.toml b/Cargo.toml index ec3f35a..9a2d4c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,9 +5,12 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +default-run = "jana_sessions_webpage" + [dependencies] 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-timers = { version = "0.3", features = ["futures"] } +serde_json = "1.0" +config = {path = "config"} \ No newline at end of file diff --git a/Trunk.toml b/Trunk.toml index 4c2681b..7076f3b 100644 --- a/Trunk.toml +++ b/Trunk.toml @@ -1,4 +1,9 @@ [build] filehash = false dist = "target/dist" -public_url = "." \ No newline at end of file +public_url = "." + +[[hooks]] +stage = "post_build" +command = "cargo" +command_arguments = ["run", "--bin", "create_static_configs"] \ No newline at end of file diff --git a/config/Cargo.toml b/config/Cargo.toml new file mode 100644 index 0000000..03f2d02 --- /dev/null +++ b/config/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "config" +version = "0.1.0" +edition = "2021" + +[dependencies] +serde = { version = "1.0", features = ["derive"] } diff --git a/config/src/lib.rs b/config/src/lib.rs new file mode 100644 index 0000000..9f1b239 --- /dev/null +++ b/config/src/lib.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct SessionConfig { + pub motd: String, +} + +impl Default for SessionConfig { + fn default() -> Self { + Self { + motd: "Proben Dienstags um 18:30 Uhr und Sonntags um 10:00 Uhr".to_string(), + } + } +} \ No newline at end of file diff --git a/index.html b/index.html index 105d24a..25b06b2 100644 --- a/index.html +++ b/index.html @@ -2,12 +2,12 @@
{format!("Failed to load Sessions config: {e}")}
}.into_any() }