Enhance calendar with Day, Week, and Year view mode - #2187
Conversation
… month, year) and refactor calendar header
…ctions for date handling
…vent fetching logic
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The implementation changes Month-view header behavior (removing month/year selectors) in a way that conflicts with the PR’s stated goal of preserving existing Month view behavior unless the description is updated or the prior controls are restored.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR extends the Events calendar UI to support Day, Week, and Year modes alongside the existing Month mode, including view-aware navigation, titles, and URL parameter synchronization, while keeping event fetching compatible with the existing SCEvents API.
Changes:
- Added Day/Week time-grid views and a Year view with mini-months and in-place date previews.
- Introduced shared view-aware helpers (range calculation, cursor stepping, titles/labels, URL param handling).
- Updated Events page state/effects to track view mode, keep URL params in sync, and fetch events for the active view’s visible range.
File summaries
| File | Description |
|---|---|
| test/frontend/CalendarViewModes.test.js | Adds unit tests covering new calendar helper behaviors for all four views. |
| src/Pages/Events/Events.js | Tracks view + cursor, syncs them to URL params, and fetches events by view-specific visible range. |
| src/Pages/Events/EventIcons.js | Adds ChevronDown icon used by the new view selector UI. |
| src/Pages/Events/Calendar/YearView.js | Implements Year view mini-month grid and sticky selected-date event preview. |
| src/Pages/Events/Calendar/TimeGrid.js | Implements Day/Week hourly grid rendering and event placement by hour/all-day. |
| src/Pages/Events/Calendar/CalendarView.js | Switches between Month/Day/Week/Year renderers and wires view-aware header + navigation. |
| src/Pages/Events/Calendar/calendarUtils.js | Adds helper utilities for visible ranges, cursor stepping, titles/labels, time bucketing, mini-month matrices, and URL params. |
| src/Pages/Events/Calendar/CalendarHeader.js | Replaces month/year selectors with a unified view selector and view-aware nav/title/count display. |
| src/Pages/Events/Calendar/calendarConstants.js | Adds VIEW_MODES definition used by header and URL parsing. |
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| <div className="relative w-28 sm:w-36"> | ||
| <select | ||
| value={month} | ||
| onChange={onMonthChange} | ||
| aria-label="Select month" | ||
| value={view} | ||
| onChange={(e) => onViewChange(e.target.value)} | ||
| aria-label="Select calendar view" | ||
| className="h-10 w-full appearance-none rounded-lg border border-slate-400/40 bg-slate-800 px-4 pr-10 text-[14px] font-semibold text-slate-100 transition hover:border-slate-300 hover:bg-slate-700 focus:outline-none focus:ring-2 focus:ring-cyan-400" | ||
| > | ||
| {MONTHS.map((monthName, index) => ( | ||
| <option key={monthName} value={index} className="bg-slate-900"> | ||
| {monthName} | ||
| </option> | ||
| ))} | ||
| </select> | ||
| </div> | ||
|
|
||
| <div className="relative w-24"> | ||
| <select | ||
| value={year} | ||
| onChange={onYearChange} | ||
| aria-label="Select year" | ||
| className="h-10 w-full appearance-none rounded-lg border border-slate-400/40 bg-slate-800 px-4 pr-10 text-[14px] font-semibold text-slate-100 transition hover:border-slate-300 hover:bg-slate-700 focus:outline-none focus:ring-2 focus:ring-cyan-400" | ||
| > | ||
| {YEAR_RANGE.map((yearOption) => ( | ||
| <option key={yearOption} value={yearOption} className="bg-slate-900"> | ||
| {yearOption} | ||
| {VIEW_MODES.map(({ label, value }) => ( | ||
| <option key={value} value={value} className="bg-slate-900"> | ||
| {label} | ||
| </option> | ||
| ))} | ||
| </select> | ||
| <div className="pointer-events-none absolute inset-y-0 right-4 flex items-center text-slate-300"> | ||
| <ChevronDown /> | ||
| </div> | ||
| </div> |
adarshm11
left a comment
There was a problem hiding this comment.
would you be able to reopen this PR with copilot review disabled
Yes I will do so now |
Summary
This pull request adds Day, Week, and Year views to the Events calendar for Issue #2160, while preserving the existing Month view structure and behavior. The calendar now supports switching between all four views from a single selector, uses view-aware navigation and titles, and keeps the current calendar cursor synchronized with the existing URL parameters.
The goal is to make calendar navigation more useful without changing the SCEvents API, database behavior, event visibility rules, or existing Month view rendering.
Calendar view improvements
Shared navigation and state
Day and Week views
Year view
Scope and compatibility
Verification
npm run lintTZ=UTC npm run frontend-testTZ=America/Los_Angeles npm run frontend-testScreenshots