Fix calendar event fetching to use visible date range
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>
This commit is contained in:
Connor Johnstone
2025-09-01 18:31:51 -04:00
parent e55e6bf4dd
commit 79f287ed61
38 changed files with 3922 additions and 2590 deletions

View File

@@ -1,6 +1,6 @@
use yew::prelude::*;
use chrono::{DateTime, Utc};
use crate::models::ical::VEvent;
use chrono::{DateTime, Utc};
use yew::prelude::*;
#[derive(Properties, PartialEq)]
pub struct EventModalProps {
@@ -16,7 +16,7 @@ pub fn EventModal(props: &EventModalProps) -> Html {
on_close.emit(());
})
};
let backdrop_click = {
let on_close = props.on_close.clone();
Callback::from(move |e: MouseEvent| {
@@ -39,7 +39,7 @@ pub fn EventModal(props: &EventModalProps) -> Html {
<strong>{"Title:"}</strong>
<span>{event.get_title()}</span>
</div>
{
if let Some(ref description) = event.description {
html! {
@@ -52,12 +52,12 @@ pub fn EventModal(props: &EventModalProps) -> Html {
html! {}
}
}
<div class="event-detail">
<strong>{"Start:"}</strong>
<span>{format_datetime(&event.dtstart, event.all_day)}</span>
</div>
{
if let Some(ref end) = event.dtend {
html! {
@@ -70,12 +70,12 @@ pub fn EventModal(props: &EventModalProps) -> Html {
html! {}
}
}
<div class="event-detail">
<strong>{"All Day:"}</strong>
<span>{if event.all_day { "Yes" } else { "No" }}</span>
</div>
{
if let Some(ref location) = event.location {
html! {
@@ -88,22 +88,22 @@ pub fn EventModal(props: &EventModalProps) -> Html {
html! {}
}
}
<div class="event-detail">
<strong>{"Status:"}</strong>
<span>{event.get_status_display()}</span>
</div>
<div class="event-detail">
<strong>{"Privacy:"}</strong>
<span>{event.get_class_display()}</span>
</div>
<div class="event-detail">
<strong>{"Priority:"}</strong>
<span>{event.get_priority_display()}</span>
</div>
{
if let Some(ref organizer) = event.organizer {
html! {
@@ -116,7 +116,7 @@ pub fn EventModal(props: &EventModalProps) -> Html {
html! {}
}
}
{
if !event.attendees.is_empty() {
html! {
@@ -129,7 +129,7 @@ pub fn EventModal(props: &EventModalProps) -> Html {
html! {}
}
}
{
if !event.categories.is_empty() {
html! {
@@ -142,7 +142,7 @@ pub fn EventModal(props: &EventModalProps) -> Html {
html! {}
}
}
{
if let Some(ref recurrence) = event.rrule {
html! {
@@ -160,7 +160,7 @@ pub fn EventModal(props: &EventModalProps) -> Html {
}
}
}
{
if !event.alarms.is_empty() {
html! {
@@ -178,7 +178,7 @@ pub fn EventModal(props: &EventModalProps) -> Html {
}
}
}
{
if let Some(ref created) = event.created {
html! {
@@ -191,7 +191,7 @@ pub fn EventModal(props: &EventModalProps) -> Html {
html! {}
}
}
{
if let Some(ref modified) = event.last_modified {
html! {
@@ -236,4 +236,3 @@ fn format_recurrence_rule(rrule: &str) -> String {
format!("Custom ({})", rrule)
}
}