Add context menus to all-day event boxes
All-day events now have the same right-click context menu functionality as regular timed events, allowing users to edit, delete, and perform other actions on all-day events. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -347,11 +347,26 @@ pub fn week_view(props: &WeekViewProps) -> Html {
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let oncontextmenu = {
|
||||||
|
if let Some(callback) = &props.on_event_context_menu {
|
||||||
|
let callback = callback.clone();
|
||||||
|
let event = (*event).clone();
|
||||||
|
Some(Callback::from(move |e: web_sys::MouseEvent| {
|
||||||
|
e.prevent_default();
|
||||||
|
e.stop_propagation(); // Prevent calendar context menu from also triggering
|
||||||
|
callback.emit((e, event.clone()));
|
||||||
|
}))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
html! {
|
html! {
|
||||||
<div
|
<div
|
||||||
class="all-day-event"
|
class="all-day-event"
|
||||||
style={format!("background-color: {}", event_color)}
|
style={format!("background-color: {}", event_color)}
|
||||||
{onclick}
|
{onclick}
|
||||||
|
{oncontextmenu}
|
||||||
>
|
>
|
||||||
<span class="all-day-event-title">
|
<span class="all-day-event-title">
|
||||||
{event.summary.as_ref().unwrap_or(&"Untitled".to_string())}
|
{event.summary.as_ref().unwrap_or(&"Untitled".to_string())}
|
||||||
|
|||||||
Reference in New Issue
Block a user