diff --git a/index.html b/index.html index 25b06b2..f810a61 100644 --- a/index.html +++ b/index.html @@ -6,6 +6,9 @@ .red { color:red; } + ul { + list-style-position: inside; + } diff --git a/src/webpage.rs b/src/webpage.rs index 14e6d36..9812e99 100644 --- a/src/webpage.rs +++ b/src/webpage.rs @@ -1,3 +1,6 @@ +use crate::localize_day; +use crate::session_date_calculator::{DayIter, NthWeekday}; +use chrono::Weekday; use leptos::prelude::*; use leptos::server_fn::request::browser::Request; use serde::{Deserialize, Serialize}; @@ -32,10 +35,29 @@ pub fn App() -> impl IntoView { #[component] fn Sessions(config: SessionConfig) -> impl IntoView { + let mut session_iter = DayIter::default().filter(move |day| { + config + .sessions + .iter() + .any(|session_day| session_day.matches(day)) + }); + let (session_dates, set_session_dates) = + signal(session_iter.by_ref().take(2).collect::>()); + view! { -
+

"Anstehende Proben Termine"

{config.motd}

+
    + {localize_day(&day)} } + /> +
+
} } @@ -67,12 +89,17 @@ where #[serde(default)] pub struct SessionConfig { pub motd: String, + pub sessions: Vec, } impl Default for SessionConfig { fn default() -> Self { Self { motd: "Proben Dienstags um 18:30 Uhr und Sonntags um 10:00 Uhr".to_string(), + sessions: vec![ + NthWeekday::new(1, Weekday::Sun), + NthWeekday::new(3, Weekday::Tue), + ], } } }