Some checks failed
Build and Push Docker Image / docker (push) Failing after 1m7s
Moved event fetching logic from CalendarView to Calendar component to properly use the visible date range instead of hardcoded current month. The Calendar component already tracks the current visible date through navigation, so events now load correctly for August and other months when navigating. Changes: - Calendar component now manages its own events state and fetching - Event fetching responds to current_date changes from navigation - CalendarView simplified to just render Calendar component - Fixed cargo fmt/clippy formatting across codebase 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
99 lines
3.2 KiB
Rust
99 lines
3.2 KiB
Rust
use crate::models::ical::VEvent;
|
|
use chrono::NaiveDateTime;
|
|
use yew::prelude::*;
|
|
|
|
#[derive(Clone, PartialEq)]
|
|
pub enum RecurringEditAction {
|
|
ThisEvent,
|
|
FutureEvents,
|
|
AllEvents,
|
|
}
|
|
|
|
#[derive(Properties, PartialEq)]
|
|
pub struct RecurringEditModalProps {
|
|
pub show: bool,
|
|
pub event: VEvent,
|
|
pub new_start: NaiveDateTime,
|
|
pub new_end: NaiveDateTime,
|
|
pub on_choice: Callback<RecurringEditAction>,
|
|
pub on_cancel: Callback<()>,
|
|
}
|
|
|
|
#[function_component(RecurringEditModal)]
|
|
pub fn recurring_edit_modal(props: &RecurringEditModalProps) -> Html {
|
|
if !props.show {
|
|
return html! {};
|
|
}
|
|
|
|
let event_title = props
|
|
.event
|
|
.summary
|
|
.as_ref()
|
|
.map(|s| s.as_str())
|
|
.unwrap_or("Untitled Event");
|
|
|
|
let on_this_event = {
|
|
let on_choice = props.on_choice.clone();
|
|
Callback::from(move |_| {
|
|
on_choice.emit(RecurringEditAction::ThisEvent);
|
|
})
|
|
};
|
|
|
|
let on_future_events = {
|
|
let on_choice = props.on_choice.clone();
|
|
Callback::from(move |_| {
|
|
on_choice.emit(RecurringEditAction::FutureEvents);
|
|
})
|
|
};
|
|
|
|
let on_all_events = {
|
|
let on_choice = props.on_choice.clone();
|
|
Callback::from(move |_| {
|
|
on_choice.emit(RecurringEditAction::AllEvents);
|
|
})
|
|
};
|
|
|
|
let on_cancel = {
|
|
let on_cancel = props.on_cancel.clone();
|
|
Callback::from(move |_| {
|
|
on_cancel.emit(());
|
|
})
|
|
};
|
|
|
|
html! {
|
|
<div class="modal-backdrop">
|
|
<div class="modal-content recurring-edit-modal">
|
|
<div class="modal-header">
|
|
<h3>{"Edit Recurring Event"}</h3>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p>{format!("You're modifying \"{}\" which is part of a recurring series.", event_title)}</p>
|
|
<p>{"How would you like to apply this change?"}</p>
|
|
|
|
<div class="recurring-edit-options">
|
|
<button class="btn btn-primary recurring-option" onclick={on_this_event}>
|
|
<div class="option-title">{"This event only"}</div>
|
|
<div class="option-description">{"Change only this occurrence"}</div>
|
|
</button>
|
|
|
|
<button class="btn btn-primary recurring-option" onclick={on_future_events}>
|
|
<div class="option-title">{"This and future events"}</div>
|
|
<div class="option-description">{"Change this occurrence and all future occurrences"}</div>
|
|
</button>
|
|
|
|
<button class="btn btn-primary recurring-option" onclick={on_all_events}>
|
|
<div class="option-title">{"All events in series"}</div>
|
|
<div class="option-description">{"Change all occurrences in the series"}</div>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button class="btn btn-secondary" onclick={on_cancel}>
|
|
{"Cancel"}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|