Add comprehensive reminder/alarm support to calendar events

- Backend: Parse VALARM components from CalDAV iCalendar data
- Backend: Add EventReminder struct with minutes_before, action, and description
- Backend: Support Display, Email, and Audio reminder types
- Backend: Parse ISO 8601 duration triggers (-PT15M, -P1D, etc.)
- Frontend: Add reminders field to CalendarEvent structure
- Frontend: Display reminders in event modal with human-readable formatting
- Frontend: Show reminder timing (15 minutes before, 1 day before) and action type
- Fix: Update Trunk.toml to properly copy CSS files to dist directory

🤖 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:37:30 -04:00
parent 01a21cb869
commit 1c4857ccad
8 changed files with 458 additions and 20 deletions

View File

@@ -5,6 +5,26 @@ use wasm_bindgen_futures::JsFuture;
use web_sys::{Request, RequestInit, RequestMode, Response};
use std::collections::HashMap;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct EventReminder {
pub minutes_before: i32,
pub action: ReminderAction,
pub description: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum ReminderAction {
Display,
Email,
Audio,
}
impl Default for ReminderAction {
fn default() -> Self {
ReminderAction::Display
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct CalendarEvent {
pub uid: String,
@@ -13,8 +33,45 @@ pub struct CalendarEvent {
pub start: DateTime<Utc>,
pub end: Option<DateTime<Utc>>,
pub location: Option<String>,
pub status: String,
pub status: EventStatus,
pub class: EventClass,
pub priority: Option<u8>,
pub organizer: Option<String>,
pub attendees: Vec<String>,
pub categories: Vec<String>,
pub created: Option<DateTime<Utc>>,
pub last_modified: Option<DateTime<Utc>>,
pub recurrence_rule: Option<String>,
pub all_day: bool,
pub reminders: Vec<EventReminder>,
pub etag: Option<String>,
pub href: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum EventStatus {
Tentative,
Confirmed,
Cancelled,
}
impl Default for EventStatus {
fn default() -> Self {
EventStatus::Confirmed
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum EventClass {
Public,
Private,
Confidential,
}
impl Default for EventClass {
fn default() -> Self {
EventClass::Public
}
}
impl CalendarEvent {
@@ -31,6 +88,38 @@ impl CalendarEvent {
pub fn get_title(&self) -> String {
self.summary.clone().unwrap_or_else(|| "Untitled Event".to_string())
}
/// Get display string for status
pub fn get_status_display(&self) -> &'static str {
match self.status {
EventStatus::Tentative => "Tentative",
EventStatus::Confirmed => "Confirmed",
EventStatus::Cancelled => "Cancelled",
}
}
/// Get display string for class
pub fn get_class_display(&self) -> &'static str {
match self.class {
EventClass::Public => "Public",
EventClass::Private => "Private",
EventClass::Confidential => "Confidential",
}
}
/// Get display string for priority
pub fn get_priority_display(&self) -> String {
match self.priority {
None => "Not set".to_string(),
Some(0) => "Undefined".to_string(),
Some(1) => "High".to_string(),
Some(p) if p <= 4 => "High".to_string(),
Some(5) => "Medium".to_string(),
Some(p) if p <= 8 => "Low".to_string(),
Some(9) => "Low".to_string(),
Some(p) => format!("Priority {}", p),
}
}
}
pub struct CalendarService {