Clean up unused code and compiler warnings

Removed unused functions and variables identified after RRULE parameter fix:
- Remove unused build_series_rrule function from backend series handler
- Remove unused RecurrenceType::from_rrule and helper functions from frontend
- Prefix unused state variables with underscores to suppress warnings

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Connor Johnstone
2025-08-31 00:45:56 -04:00
parent 3ccf31f479
commit 63968280b8
4 changed files with 4 additions and 84 deletions

View File

@@ -460,34 +460,6 @@ pub async fn delete_event_series(
// Helper functions
fn build_series_rrule(request: &CreateEventSeriesRequest) -> Result<String, ApiError> {
// Extract frequency from request
let recurrence_freq = if request.recurrence.contains("FREQ=") {
// Parse RRULE to extract frequency
if request.recurrence.contains("FREQ=DAILY") {
"daily"
} else if request.recurrence.contains("FREQ=WEEKLY") {
"weekly"
} else if request.recurrence.contains("FREQ=MONTHLY") {
"monthly"
} else if request.recurrence.contains("FREQ=YEARLY") {
"yearly"
} else {
return Err(ApiError::BadRequest("Invalid RRULE frequency".to_string()));
}
} else {
let lower = request.recurrence.to_lowercase();
match lower.as_str() {
"daily" => "daily",
"weekly" => "weekly",
"monthly" => "monthly",
"yearly" => "yearly",
_ => return Err(ApiError::BadRequest("Invalid recurrence type".to_string())),
}
};
build_series_rrule_with_freq(request, recurrence_freq)
}
fn build_series_rrule_with_freq(request: &CreateEventSeriesRequest, freq: &str) -> Result<String, ApiError> {
let mut rrule_parts = Vec::new();

View File

@@ -54,9 +54,9 @@ pub fn App() -> Html {
let calendar_context_menu_date = use_state(|| -> Option<NaiveDate> { None });
let create_event_modal_open = use_state(|| false);
let selected_date_for_event = use_state(|| -> Option<NaiveDate> { None });
let recurring_edit_modal_open = use_state(|| false);
let recurring_edit_event = use_state(|| -> Option<VEvent> { None });
let recurring_edit_data = use_state(|| -> Option<EventCreationData> { None });
let _recurring_edit_modal_open = use_state(|| false);
let _recurring_edit_event = use_state(|| -> Option<VEvent> { None });
let _recurring_edit_data = use_state(|| -> Option<EventCreationData> { None });
// Calendar view state - load from localStorage if available
let current_view = use_state(|| {

View File

@@ -81,17 +81,6 @@ impl Default for RecurrenceType {
}
}
impl RecurrenceType {
pub fn from_rrule(rrule: Option<&str>) -> Self {
match rrule {
Some(rule) if rule.contains("FREQ=DAILY") => RecurrenceType::Daily,
Some(rule) if rule.contains("FREQ=WEEKLY") => RecurrenceType::Weekly,
Some(rule) if rule.contains("FREQ=MONTHLY") => RecurrenceType::Monthly,
Some(rule) if rule.contains("FREQ=YEARLY") => RecurrenceType::Yearly,
_ => RecurrenceType::None,
}
}
}
/// Parse RRULE string into recurrence components
/// Example RRULE: "FREQ=WEEKLY;INTERVAL=2;BYDAY=MO,WE,FR;UNTIL=20231215T000000Z"
@@ -763,7 +752,7 @@ pub fn create_event_modal(props: &CreateEventModalProps) -> Html {
})
};
let on_priority_input = {
let _on_priority_input = {
let event_data = event_data.clone();
Callback::from(move |e: InputEvent| {
if let Some(input) = e.target_dyn_into::<HtmlInputElement>() {

View File

@@ -866,34 +866,6 @@ impl CalendarService {
}
/// Calculate next weekday occurrence for WEEKLY frequency with BYDAY
fn next_weekday_occurrence(current_date: NaiveDate, byday: &str, interval: i32) -> NaiveDate {
let weekdays = Self::parse_byday(byday);
if weekdays.is_empty() {
return current_date + Duration::weeks(interval as i64);
}
let current_weekday = current_date.weekday();
// Find next occurrence within current week
let mut next_occurrences = Vec::new();
for &target_weekday in &weekdays {
let days_until = Self::days_until_weekday(current_weekday, target_weekday);
if days_until > 0 {
next_occurrences.push((days_until, target_weekday));
}
}
// Sort by days_until and return the closest one
if !next_occurrences.is_empty() {
next_occurrences.sort_by_key(|(days, _)| *days);
return current_date + Duration::days(next_occurrences[0].0 as i64);
}
// No more occurrences this week, move to next interval
let next_week_start = current_date + Duration::weeks(interval as i64) - Duration::days(current_weekday.num_days_from_monday() as i64);
next_week_start + Duration::days(weekdays[0].num_days_from_monday() as i64)
}
/// Parse BYDAY parameter (e.g., "MO,WE,FR" -> [Monday, Wednesday, Friday])
fn parse_byday(byday: &str) -> Vec<Weekday> {
@@ -912,19 +884,6 @@ impl CalendarService {
.collect()
}
/// Calculate days until target weekday
fn days_until_weekday(from: Weekday, to: Weekday) -> i32 {
let from_num = from.num_days_from_monday();
let to_num = to.num_days_from_monday();
if to_num > from_num {
(to_num - from_num) as i32
} else if to_num < from_num {
(7 + to_num - from_num) as i32
} else {
0 // Same day
}
}
/// Add months to a date (handling month boundary issues)
fn add_months(date: NaiveDate, months: i32) -> Option<NaiveDate> {