Skip to content

Conversation

@chadbrokaw
Copy link
Collaborator

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-calendar in 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:

  • Removed all usage of react-big-calendar and related logic from EventCalendar.tsx, switching to a custom agenda-style calendar for both desktop and mobile, simplifying the code and improving maintainability. [1] [2] [3]
  • Refactored category filtering: removed dynamic color mapping and dark color logic, and unified category chip/button styles to use a consistent black/white color scheme. [1] [2] [3]

Visual and Accessibility Improvements:

  • Updated button and category colors throughout the calendar UI to use a consistent palette (e.g., primary buttons now use #cd4a23), and improved hover/focus states for better accessibility. [1] [2] [3]
  • Improved agenda event layout: enhanced padding, spacing, and responsive behavior for event chips, time columns, and event titles, ensuring a better experience on all screen sizes. [1] [2] [3] [4]

Event Details and Slideout Enhancements:

  • Updated the event slideout to display event titles using sanitized HTML for better formatting and security, and standardized category badges and event dots to use the new color scheme. [1] [2] [3]

General Code Cleanup:

  • Removed unused imports, props, and logic related to the previous calendar implementation and category color mapping, resulting in a simpler and more maintainable codebase. [1] [2] [3] [4] [5] [6]

These changes collectively modernize the event calendar, making it easier to maintain and more visually consistent across devices.

Copy link

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 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;
Copy link

Copilot AI Oct 17, 2025

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).

Suggested change
width: 1fr;
width: 100%;

Copilot uses AI. Check for mistakes.
Comment on lines 49 to 55
setCategoryFilters(
availableCategories.map((category, index) => ({
category,
enabled: true,
enabled: category === categoryWithMostEvents, // Only category with most events is enabled by default
color: getCategoryColor(index),
}))
);
Copy link

Copilot AI Oct 17, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +105 to 113
// 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,
}))
);
};
Copy link

Copilot AI Oct 17, 2025

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.

Copilot uses AI. Check for mistakes.
<div className={styles.dateHeaderTitle}>
<h2>{formatDateHeader(currentDate)}</h2>
{new Date().toDateString() !== currentDate.toDateString() && (
<button onClick={onGoToToday}>Go to today</button>
Copy link

Copilot AI Oct 17, 2025

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.

Suggested change
<button onClick={onGoToToday}>Go to today</button>
<button type="button" onClick={onGoToToday}>Go to today</button>

Copilot uses AI. Check for mistakes.
margin-top: $general-spacing-lg;
border: none;
border-radius: 0.375rem;
background-color: #111928; // Light gray with 50% opacity
Copy link

Copilot AI Oct 17, 2025

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.

Suggested change
background-color: #111928; // Light gray with 50% opacity
background-color: #111928;

Copilot uses AI. Check for mistakes.
Comment on lines 30 to 37
{hasMoreEvents && !showAll && (
<button
className={styles.showMoreButton}
onClick={() => setShowAll(true)}
>
Show More
</button>
)}
Copy link

Copilot AI Oct 17, 2025

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.

Copilot uses AI. Check for mistakes.
export interface CalendarEvent extends Event {
// Base event interface (replacing react-big-calendar's Event type)
export interface BaseEvent {
title?: ReactNode;
Copy link

Copilot AI Oct 17, 2025

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.

Suggested change
title?: ReactNode;
title?: string;

Copilot uses AI. Check for mistakes.
background: #0056b3;
background: #a63b1b;
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
Copy link

Copilot AI Oct 17, 2025

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.

Suggested change
box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
box-shadow: 0 4px 8px rgba(205, 74, 35, 0.3);

Copilot uses AI. Check for mistakes.
@chadbrokaw chadbrokaw changed the title Development feat: Use new calendar agenda view and other fixes Oct 17, 2025
@chadbrokaw chadbrokaw merged commit 345ab7e into main Oct 17, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants