Refactor event modal into standalone component

- Created dedicated EventModal component in src/components/event_modal.rs
- Extracted modal logic and styling from calendar component for better separation
- Updated data flow to pass full CalendarEvent objects instead of strings
- Added PartialEq derive to CalendarEvent for component props
- Updated service layer to group events by CalendarEvent objects
- Enhanced event click handling to show detailed event information
- Modal displays title, description, location, start/end times, and status
- Maintained existing modal styling and user interaction patterns

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Connor Johnstone
2025-08-28 17:18:39 -04:00
parent a3d1612dac
commit b1b8e1e580
7 changed files with 270 additions and 14 deletions

View File

@@ -5,7 +5,7 @@ use wasm_bindgen_futures::JsFuture;
use web_sys::{Request, RequestInit, RequestMode, Response};
use std::collections::HashMap;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct CalendarEvent {
pub uid: String,
pub summary: Option<String>,
@@ -91,16 +91,15 @@ impl CalendarService {
}
/// Convert events to a HashMap grouped by date for calendar display
pub fn group_events_by_date(events: Vec<CalendarEvent>) -> HashMap<NaiveDate, Vec<String>> {
pub fn group_events_by_date(events: Vec<CalendarEvent>) -> HashMap<NaiveDate, Vec<CalendarEvent>> {
let mut grouped = HashMap::new();
for event in events {
let date = event.get_date();
let title = event.get_title();
grouped.entry(date)
.or_insert_with(Vec::new)
.push(title);
.push(event);
}
grouped