Implement real-time event refresh functionality
- Backend: Add GET /api/calendar/events/:uid endpoint for single event refresh - Backend: Implement fetch_event_by_uid method to retrieve updated events from CalDAV - Frontend: Add event click callback system to trigger refresh on interaction - Frontend: Display loading state with orange pulsing animation during refresh - Frontend: Smart event data updates without full calendar reload - Frontend: Graceful error handling with fallback to cached data - CSS: Add refreshing animation for visual feedback during updates Events now automatically refresh from CalDAV server when clicked, ensuring users always see the most current event data including changes made in other calendar applications. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
		| @@ -8,6 +8,9 @@ use crate::components::EventModal; | ||||
| pub struct CalendarProps { | ||||
|     #[prop_or_default] | ||||
|     pub events: HashMap<NaiveDate, Vec<CalendarEvent>>, | ||||
|     pub on_event_click: Callback<CalendarEvent>, | ||||
|     #[prop_or_default] | ||||
|     pub refreshing_event_uid: Option<String>, | ||||
| } | ||||
|  | ||||
| #[function_component] | ||||
| @@ -105,18 +108,24 @@ pub fn Calendar(props: &CalendarProps) -> Html { | ||||
|                                                     events.iter().take(2).map(|event| { | ||||
|                                                         let event_clone = event.clone(); | ||||
|                                                         let selected_event_clone = selected_event.clone(); | ||||
|                                                         let on_event_click = props.on_event_click.clone(); | ||||
|                                                         let event_click = Callback::from(move |e: MouseEvent| { | ||||
|                                                             e.stop_propagation(); // Prevent day selection | ||||
|                                                             on_event_click.emit(event_clone.clone()); | ||||
|                                                             selected_event_clone.set(Some(event_clone.clone())); | ||||
|                                                         }); | ||||
|                                                          | ||||
|                                                         let title = event.get_title(); | ||||
|                                                         let is_refreshing = props.refreshing_event_uid.as_ref() == Some(&event.uid); | ||||
|                                                         let class_name = if is_refreshing { "event-box refreshing" } else { "event-box" }; | ||||
|                                                         html! {  | ||||
|                                                             <div class="event-box"  | ||||
|                                                             <div class={class_name}  | ||||
|                                                                  title={title.clone()}  | ||||
|                                                                  onclick={event_click}> | ||||
|                                                                 { | ||||
|                                                                     if title.len() > 15 { | ||||
|                                                                     if is_refreshing { | ||||
|                                                                         "🔄 Refreshing...".to_string() | ||||
|                                                                     } else if title.len() > 15 { | ||||
|                                                                         format!("{}...", &title[..12]) | ||||
|                                                                     } else { | ||||
|                                                                         title | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Connor Johnstone
					Connor Johnstone