-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Use new calendar agenda view and other fixes #356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add typing for react-gtm-module fix: temporarily deploy Google Analytics to staging fix: add temporary logging fix: remove GA4 logging
* fix: change language * test: fix test
There was a problem hiding this 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 refactor replaces react-big-calendar with a custom agenda-style calendar, unifies category/button styles, and adds Algolia exclusion filtering for search/browse results. Key changes:
- Custom agenda calendar replaces react-big-calendar; category filters become single-select with updated UI and slideout uses sanitized HTML.
- New createExclusionFilters integrates consistent Algolia filters into Search and Browse results.
- Renamed Strapi homepage hook to useHomePageFeaturedResourcesData and updated event/resource sections accordingly; styling updates across calendar components.
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Removed react-big-calendar dependency to support custom agenda calendar. |
| app/utils/exclusionFilters.ts | Added Algolia exclusion filter builder per business rules; consumed by Search/Browse pages. |
| app/pages/SearchResultsPage/SearchResultsPage.tsx | Applied exclusion filters to Configure for both geo modes. |
| app/pages/HomePage/HomePage.tsx | Switched to useHomePageFeaturedResourcesData and updated featured section ids/layout. |
| app/pages/HomePage/HomePage.test.tsx | Updated mocks/types to reflect renamed homepage hook. |
| app/pages/EventDetailPage/EventDetailPage.tsx | Render “Details” section only when rows exist. |
| app/pages/BrowseResultsPage/BrowseResultsPage.tsx | Applied combined category + exclusion filters; minor comment fix. |
| app/hooks/StrapiAPI.ts | Renamed hook to useHomePageFeaturedResourcesData. |
| app/hooks/SFGovAPI.ts | Updated SFGovEvent interface to events_category. |
| app/components/ui/Cards/EventCardSection.tsx | Added Show More/Less behavior for featured resources. |
| app/components/ui/Cards/EventCardSection.module.scss | Added styles for Show More/Less button. |
| app/components/ui/Calendar/utils.ts | Updated category helpers to use events_category. |
| app/components/ui/Calendar/types.ts | Replaced react-big-calendar types with local BaseEvent/CalendarEvent; adjusted props. |
| app/components/ui/Calendar/index.ts | Removed CustomToolbar export (no longer needed). |
| app/components/ui/Calendar/hooks.ts | Updated category processing to single-select default; filtered events by selected day. |
| app/components/ui/Calendar/components/MobileAgenda.tsx | Added “Go to today”; sanitized title HTML; layout refinements. |
| app/components/ui/Calendar/components/EventSlideout.tsx | Sanitized title; standardized category badge/dots; removed color map prop. |
| app/components/ui/Calendar/components/CustomToolbar.tsx | Removed now-unused toolbar component. |
| app/components/ui/Calendar/EventCalendar.tsx | Removed react-big-calendar; always render agenda; slideout wiring; added goToToday. |
| app/components/ui/Calendar/EventCalendar.module.scss | Restyled agenda, filters, and buttons to new palette and responsive behavior. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| } | ||
|
|
||
| .showMoreButton { | ||
| width: 1fr; |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
width: 1fr is not a valid CSS length on regular elements (fr units apply to grid track sizing, not width). Use width: 100% (or make the parent a grid and size the track with 1fr).
| width: 1fr; | |
| width: 100%; |
| setCategoryFilters( | ||
| availableCategories.map((category, index) => ({ | ||
| category, | ||
| enabled: true, | ||
| enabled: category === categoryWithMostEvents, // Only category with most events is enabled by default | ||
| color: getCategoryColor(index), | ||
| })) | ||
| ); |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The color field in CategoryFilter and associated getCategoryColor logic are no longer used in the UI (chips no longer read color or CSS vars). Consider removing the color property from CategoryFilter, the getCategoryColor usage here, and the categoryColorMap computation to simplify state and avoid unnecessary work.
| // Toggle category filter - only one can be selected at a time (radio button behavior) | ||
| const toggleCategory = (category: string) => { | ||
| setCategoryFilters((prev) => | ||
| prev.map((filter) => | ||
| filter.category === category | ||
| ? { ...filter, enabled: !filter.enabled } | ||
| : filter | ||
| ) | ||
| prev.map((filter) => ({ | ||
| ...filter, | ||
| enabled: filter.category === category, | ||
| })) | ||
| ); | ||
| }; |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This enforces single-selection, but the 'Update category filters when available categories change' effect (in this file) still adds new categories with enabled: true, which can result in multiple enabled categories after categories change. Update that effect so newly added categories default to enabled: false (unless they match the currently enabled category) to maintain the single-select invariant.
| <div className={styles.dateHeaderTitle}> | ||
| <h2>{formatDateHeader(currentDate)}</h2> | ||
| {new Date().toDateString() !== currentDate.toDateString() && ( | ||
| <button onClick={onGoToToday}>Go to today</button> |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add type="button" to prevent accidental form submission if this component is ever rendered inside a form.
| <button onClick={onGoToToday}>Go to today</button> | |
| <button type="button" onClick={onGoToToday}>Go to today</button> |
| margin-top: $general-spacing-lg; | ||
| border: none; | ||
| border-radius: 0.375rem; | ||
| background-color: #111928; // Light gray with 50% opacity |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment does not match the color (#111928 is a dark slate, not a light gray at 50% opacity). Update the comment to reflect the actual color or remove it to avoid confusion.
| background-color: #111928; // Light gray with 50% opacity | |
| background-color: #111928; |
| {hasMoreEvents && !showAll && ( | ||
| <button | ||
| className={styles.showMoreButton} | ||
| onClick={() => setShowAll(true)} | ||
| > | ||
| Show More | ||
| </button> | ||
| )} |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding aria-expanded and aria-controls to the Show More/Show Less buttons (and an id on the cards container) to announce the toggle state to assistive technologies.
app/components/ui/Calendar/types.ts
Outdated
| export interface CalendarEvent extends Event { | ||
| // Base event interface (replacing react-big-calendar's Event type) | ||
| export interface BaseEvent { | ||
| title?: ReactNode; |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title is typed as ReactNode, but downstream code sanitizes it as an HTML string (String(event.title || "")), which will coerce non-string nodes to "[object Object]". If titles are always strings in this calendar, change the type to string to better reflect usage and avoid accidental coercion.
| title?: ReactNode; | |
| title?: string; |
| background: #0056b3; | ||
| background: #a63b1b; | ||
| transform: translateY(-1px); | ||
| box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3); |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hover box-shadow still uses the old blue (rgba(0, 123, 255, ...)) while the primary button was switched to #cd4a23. Update the shadow color to match the new palette for visual consistency.
| box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3); | |
| box-shadow: 0 4px 8px rgba(205, 74, 35, 0.3); |
This pull request significantly refactors the event calendar's UI and codebase to simplify dependencies, unify the visual design, and improve mobile responsiveness. The core changes include removing the dependency on
react-big-calendarin favor of a fully custom agenda-style calendar, unifying category and button styles, and enhancing the layout and accessibility of event details.Major UI and UX Refactor:
react-big-calendarand related logic fromEventCalendar.tsx, switching to a custom agenda-style calendar for both desktop and mobile, simplifying the code and improving maintainability. [1] [2] [3]Visual and Accessibility Improvements:
#cd4a23), and improved hover/focus states for better accessibility. [1] [2] [3]Event Details and Slideout Enhancements:
General Code Cleanup:
These changes collectively modernize the event calendar, making it easier to maintain and more visually consistent across devices.