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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user