use crate::models::ical::VEvent; use chrono::{DateTime, Utc}; use yew::prelude::*; #[derive(Properties, PartialEq)] pub struct EventModalProps { pub event: Option, pub on_close: Callback<()>, } #[function_component] pub fn EventModal(props: &EventModalProps) -> Html { let close_modal = { let on_close = props.on_close.clone(); Callback::from(move |_| { on_close.emit(()); }) }; let backdrop_click = { let on_close = props.on_close.clone(); Callback::from(move |e: MouseEvent| { if e.target() == e.current_target() { on_close.emit(()); } }) }; if let Some(ref event) = props.event { html! { } } else { html! {} } } fn format_datetime(dt: &DateTime, all_day: bool) -> String { if all_day { dt.format("%B %d, %Y").to_string() } else { dt.format("%B %d, %Y at %I:%M %p").to_string() } } fn format_recurrence_rule(rrule: &str) -> String { // Basic parsing of RRULE to display user-friendly text if rrule.contains("FREQ=DAILY") { "Daily".to_string() } else if rrule.contains("FREQ=WEEKLY") { "Weekly".to_string() } else if rrule.contains("FREQ=MONTHLY") { "Monthly".to_string() } else if rrule.contains("FREQ=YEARLY") { "Yearly".to_string() } else { // Show the raw rule if we can't parse it format!("Custom ({})", rrule) } }