Files
calendar/frontend/src/components/calendar_context_menu.rs
Connor Johnstone 15f2d0c6d9 Implement shared RFC 5545 VEvent library with workspace restructuring
- Created calendar-models/ shared library with RFC 5545-compliant VEvent structures
- Migrated backend to use shared VEvent with proper field mappings (dtstart/dtend, rrule, exdate, etc.)
- Converted CalDAV client to parse into VEvent structures with structured types
- Updated all CRUD handlers to use VEvent with CalendarUser, Attendee, VAlarm types
- Restructured project as Cargo workspace with frontend/, backend/, calendar-models/
- Updated Trunk configuration for new directory structure
- Fixed all compilation errors and field references throughout codebase
- Updated documentation and build instructions for workspace structure

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-30 11:45:58 -04:00

47 lines
1.2 KiB
Rust

use yew::prelude::*;
use web_sys::MouseEvent;
#[derive(Properties, PartialEq)]
pub struct CalendarContextMenuProps {
pub is_open: bool,
pub x: i32,
pub y: i32,
pub on_close: Callback<()>,
pub on_create_event: Callback<MouseEvent>,
}
#[function_component(CalendarContextMenu)]
pub fn calendar_context_menu(props: &CalendarContextMenuProps) -> Html {
let menu_ref = use_node_ref();
if !props.is_open {
return html! {};
}
let style = format!(
"position: fixed; left: {}px; top: {}px; z-index: 1001;",
props.x, props.y
);
let on_create_event_click = {
let on_create_event = props.on_create_event.clone();
let on_close = props.on_close.clone();
Callback::from(move |e: MouseEvent| {
on_create_event.emit(e);
on_close.emit(());
})
};
html! {
<div
ref={menu_ref}
class="context-menu"
style={style}
>
<div class="context-menu-item context-menu-create" onclick={on_create_event_click}>
<span class="context-menu-icon">{"+"}</span>
{"Create Event"}
</div>
</div>
}
}