Skip to content

replace calendar library#6567

Merged
compwron merged 5 commits intomainfrom
replace-calendar-library
Nov 7, 2025
Merged

replace calendar library#6567
compwron merged 5 commits intomainfrom
replace-calendar-library

Conversation

@compwron
Copy link
Collaborator

@compwron compwron commented Oct 22, 2025

@github-actions github-actions bot added dependencies Pull requests that update a dependency file javascript for use by Github Labeler to mark pull requests that update Javascript code labels Oct 22, 2025
@github-actions github-actions bot added the erb label Nov 7, 2025
@compwron compwron marked this pull request as ready for review November 7, 2025 06:00
@compwron compwron force-pushed the replace-calendar-library branch from b2b573a to 4b88c4c Compare November 7, 2025 06:00
@compwron compwron requested a review from Copilot November 7, 2025 06:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the calendar functionality from the deprecated add2calendar package to the modern add-to-calendar-button web component library (version 2.12.12).

Key changes:

  • Replaced add2calendar (v1.1.8) with add-to-calendar-button (v2.12.12) and its dependency timezones-ical-library
  • Updated JavaScript implementation to use web components instead of the old API
  • Modified court dates display to include calendar buttons with improved styling

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
package.json Updated dependency from add2calendar to add-to-calendar-button
package-lock.json Reflected dependency changes including new timezones-ical-library transitive dependency
app/views/casa_cases/_court_dates.html.erb Added calendar button rendering for each court date with proper date formatting
app/javascript/src/add_to_calendar_button.js Migrated from old Add2Calendar API to web component creation with proper attribute setting
app/assets/stylesheets/pages/casa_cases.scss Added flexbox styling for court date rows and calendar button sizing
app/assets/stylesheets/application.scss Removed obsolete add2calendar stylesheet import

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

button.setAttribute('startDate', calendarButton.dataset.start)
button.setAttribute('endDate', calendarButton.dataset.end)
button.setAttribute('description', calendarButton.dataset.title)
button.setAttribute('options', "'Apple','Google','iCal','Microsoft365','Outlook.com','Yahoo'")
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The options attribute value has incorrect quoting. The inner single quotes will be interpreted as part of the string literal instead of being parsed as individual options. This should be a JSON array format. Change to: button.setAttribute('options', \"['Apple','Google','iCal','Microsoft365','Outlook.com','Yahoo']\") or use the documented array format for the add-to-calendar-button library.

Suggested change
button.setAttribute('options', "'Apple','Google','iCal','Microsoft365','Outlook.com','Yahoo'")
button.setAttribute('options', '["Apple","Google","iCal","Microsoft365","Outlook.com","Yahoo"]')

Copilot uses AI. Check for mistakes.
.court-date-row {
display: flex;
align-items: center;
gap: 10px;
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using a consistent spacing unit. The codebase appears to use pixel values elsewhere, but it would be better to use a spacing variable or rem units for consistency and accessibility. For example, gap: 0.625rem; (equivalent to 10px at default font size).

Suggested change
gap: 10px;
gap: 0.625rem;

Copilot uses AI. Check for mistakes.
Comment on lines 45 to 54
.a2cldr {
width: 120px !important;

.a2cldr-btn {
width: 120px !important;
font-size: 12px;
padding: 4px 8px;
text-align: center;
}
}
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .a2cldr class selector appears to be from the old add2calendar library. With the migration to add-to-calendar-button, these selectors may no longer match the actual DOM elements generated by the new web component. Verify that these CSS rules target the correct elements in the new library, or update the selectors to match the new component's structure.

Copilot uses AI. Check for mistakes.
@compwron compwron merged commit e11e42e into main Nov 7, 2025
13 checks passed
@compwron compwron deleted the replace-calendar-library branch November 7, 2025 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file erb javascript for use by Github Labeler to mark pull requests that update Javascript code Tests! 🎉💖👏

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant