Make motd optional

This commit is contained in:
Leonard Steppy 2025-02-15 02:01:18 +01:00
parent 258dcd7298
commit da42de5c92

View File

@ -20,14 +20,13 @@ pub fn App() -> impl IntoView {
let config = config.unwrap_or_default(); let config = config.unwrap_or_default();
view! { <Sessions config /> }.into_any() view! { <Sessions config /> }.into_any()
} }
Err(e) => { Err(e) => view! {
view! { <div class="box error-background">
<div class="box error-background"> <h1>"Error"</h1>
<h1>"Error"</h1> <p>{e}</p>
<p>{e}</p> </div>
</div>
}.into_any()
} }
.into_any(),
}) })
}; };
@ -98,14 +97,14 @@ where
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default)] #[serde(default)]
pub struct SessionConfig { pub struct SessionConfig {
pub motd: String, pub motd: Option<String>,
pub sessions: Vec<NthWeekday>, pub sessions: Vec<NthWeekday>,
} }
impl Default for SessionConfig { impl Default for SessionConfig {
fn default() -> Self { fn default() -> Self {
Self { Self {
motd: "Proben Dienstags um 18:30 Uhr und Sonntags um 10:00 Uhr".to_string(), motd: Some("Probe jeden ersten Sonntag im Monat um 10:00 Uhr und jeden dritten Dienstag im Monat um 18:30 Uhr".to_string()),
sessions: vec![ sessions: vec![
NthWeekday::new(1, Weekday::Sun), NthWeekday::new(1, Weekday::Sun),
NthWeekday::new(3, Weekday::Tue), NthWeekday::new(3, Weekday::Tue),