Repository navigation
Description
Summary
On a phone the calendar's Month button is lit while the body shows the day list, and clicking Month cannot change it. Schedule-X moves itself off month-grid when it mounts below its breakpoint, because that view declares no small-screen support, and nothing tells our own view switch. Measured on sahajatlas.com/calendar, headless Chromium: at 390×844 .sx__view-container's child is sx__list-wrapper while the switch shows Month; at 1280×900 the same state gives sx__month-grid-wrapper.
Decisions
- What should "Month" offer on a phone? → A: register
createViewMonthAgenda()for small screens, so Month shows a month date-picker over the selected day's agenda and the switch keeps three options at every width (Ardnived, 2026-10-25) - What should "Week" offer on a phone? → A: hide Week below the crossing, so the switch offers two options there and three above it. Schedule-X ships no small-screen week, and a 7-column time grid at 390px was never readable (Ardnived, 2026-10-26)
Approach
What Schedule-X actually does
Read from the pinned 2.36.0 build, node_modules/@schedule-x/calendar/dist/core.js:
| registered view | hasSmallScreenCompat |
hasWideScreenCompat |
wrapper class |
|---|---|---|---|
month-grid |
false | true | sx__month-grid-wrapper |
week |
false | true | sx__week-wrapper |
list |
true | true | sx__list-wrapper |
month-agenda (not registered) |
true | false | sx__month-agenda-wrapper |
day (not registered) |
true | true | sx__week-wrapper |
setScreenSizeCompatibleView (core.js:2442) is the only place either flag is enforced on the rendered view, and handleWindowResize is its only caller — once at mount and afterwards only when the small/wide state changes. When the current view lacks the flag for the new state, it switches to the first registered view that has it. Registration order is [month-grid, week, list] (src/views/CalendarView/CalendarView.tsx:303), so the first small-compat view is list — the measured sx__list-wrapper.
Four things that follow, and that the fix is built against:
controls.setView()never checks either flag (@schedule-x/calendar-controls,setView): it validates that the name is registered, then sets it. An explicit click therefore does rendermonth-gridat 390×844. The collapse is a mount-time and crossing-time rewrite, not a per-click refusal.weekis refused on small screens too. The switch loses Month and Week on a phone mount, from one root cause, so both belong in this fix.- SX 2.36 exposes no view-change callback.
CalendarCallbacks(core.d.ts) hasonSelectedDateUpdate,onRangeUpdateand the click callbacks, and nothing for the view. The rewrite cannot be observed, so it has to be prevented: never let SX pick a view. isResponsive: falseremoves the rewrite outright, and this app loses nothing by it. The resize listener is registered onlyif ($app.config.isResponsive)(core.js:2541), and that is the only path intosetScreenSizeCompatibleView, so both the mount rewrite and the crossing rewrite disappear.isCalendarSmallthen staysundefined(core.js:4638), and its only two readers are SX's own view dropdown (ViewSelection,core.js:1122) and thesx__is-calendar-smallclass — whose three rules in@schedule-x/theme-defaultall target SX's header chrome (sx__forward-backward-navigation,sx__range-heading,sx__today-button), and this app hides that header (src/styles/globals.css:532). Neither compat flag is then consulted anywhere, so the resolver below is the only thing that decides, with no registration order to depend on and no race between SX's ownresizelistener and this app's dampedResizeObserversignal (SETTLE_MS,src/config/responsive.ts).
Why clicking Month cannot recover it today: the switch's value is already VIEW_MONTH on a phone (:150, the store's null ?? VIEW_MONTH), so Radix's single-value ToggleGroup reads the click as a deselect and emits '', which selectView drops (:121). Keep that guard — the value must stop lying, rather than an empty value being let through.
The fix
-
A pure resolver in
src/lib/shape/calendar.ts, besideeventsToCalendarEntries: given a stored view name and a width class, return both the SX view name to render and the option the switch lights.stored at or above 768px below 768px month-grid(alsonull)month-grid, Month litmonth-agenda, Month litweekweek, Week litmonth-agenda, Month litlistlist, List litlist, List litweekcollapses ontomonth-agendarather thanlistbecause it is the one small-screen view that keeps a chosen day's own hours in view, which is what Week was being read for; it also leaves one answer below the crossing for every non-list view. Never write a width-specific name into the store, so a storedweeksurvives a trip through a phone width and lights Week again above the crossing. The resolver belongs inlib/shapebecause the node lane can test it —src/views/CalendarViewcannot be driven across the crossing, as jsdom has noResizeObserver(src/config/responsive.ts). -
Register the fourth view and turn SX's own responsiveness off (
:303):views: [createViewMonthGrid(), createViewMonthAgenda(), createViewWeek(), createViewList()], plusisResponsive: false.controls.setViewvalidates the name against that list, somonth-agendahas to be registered even though the resolver, never SX, chooses it. -
Resolve at the three seams in
CalendarView.tsx:defaultView(:305),selectView'scontrols.setView(:120), and the ToggleGroup'svalue(:150).useIsWideWidget()is the single signal —CalendarControlsandCalendarGridboth sit underWidgetWidthContext.CalendarGridcaptures its config once at mount, so the crossing needs an effect of its own: when the resolved SX name changes, drivecontrols.setViewto it. Nothing competes with that call once step 2 lands. -
Hide the Week option below the crossing (
:154), and read the resolved option — not the stored name — inlabel(:105) andstep(:128). Both branch onVIEW_WEEK, so a storedweekon a phone would otherwise label the week's first day and page by whole weeks while a month agenda renders. -
Wire
onClickAgendaDate(core.d.ts:300, emitted atcore.js:5939) touseCalendarPosition.setDate, beside the other callbacks (:317).onSelectedDateUpdateis emitted only from the date picker's own change callback (createDateSelectionCallback), so a day picked in the agenda grid would otherwise leave the header's date label behind. -
src/views/DrawerStack/DrawerStack.tsx:307picks the full-width drawer from the stored view (calendarView !== 'list'). Read the resolved option there instead, from theisWideit already has:month-agendais a single narrow column, like the list view that test already excludes. The same test also hides the settings cog (:806), so today a phone in month view has no cog at all.
No new translation key is needed: the switch keeps calendar.view_month and calendar.view_week (:153, :154), and hiding a button needs no copy. No new CSS either — @schedule-x/theme-default ships the sx__month-agenda-* rules, and globals.css:542 already names .sx__month-agenda-event.
Acceptance criteria
- At 390×844 every option the view switch offers renders a visibly different body, and the lit option matches what rendered — at first paint, before any click, as well as after one.
- Below the crossing the switch offers Month and List. At or above it, Month, Week and List.
- At 1280×900 the three views behave exactly as they do today.
- A stored view the current width cannot render resolves to one that can, rather than lighting a button that does nothing. This holds across a grid remount — a filter apply, or returning from an event — and across a resize over the crossing in both directions, restoring the stored view wherever the width allows it.
Verification checklist
- Playwright at 390×844 and at 1280×900: read the class of
.sx__view-container's first child at first paint, then after clicking each option in turn. No two options share a class at either size. At 390 the switch has two options and Month givessx__month-agenda-wrapper; at 1280 it has three and Month givessx__month-grid-wrapper. - Playwright at 390×844: select Month, apply a filter to remount the keyed grid, and confirm the lit button still matches the rendered body.
- Playwright: select Week at 1280×900, resize to 390×844 —
sx__month-agenda-wrapperrenders and Month is lit — then resize back and confirm Week is lit oversx__week-wrapper. - Playwright at 390×844 in Month view: the settings cog renders (
DrawerStack'swidetest). -
pnpm test:run src/lib/shape/calendarwith cases over the stored-view × width mapping in both directions, including thelistpass-through and theweekcollapse. -
.claude/skills/pr-prep/check.sh
Notes
Found while verifying #319 on a phone viewport (2026-10-25). Unrelated to #319's own root cause — the drawer panel being a scroll container — which #326 and PR #328 fix.
Registering createViewDay() and mapping Week → Day below the crossing was the rejected option B for question 2. day renders sx__week-wrapper, so Week and Day are indistinguishable by wrapper class, and a button saying Week over a single day needs a new label — translations are CMS-owned, so it would have waited on a sydevs/SahajCloud issue.
sx__is-calendar-small, Schedule-X's own class on .sx__calendar-wrapper, is a styling marker only. It never gated which view renders; setScreenSizeCompatibleView did, and isResponsive: false retires both.
useCalendarPosition is a plain zustand store with no persistence middleware, and src/config/store.ts:159 says so: the view and date are session-scoped and clear on reload. So a reload cannot reproduce a stale stored view — a remount can, which is why the criteria and the checklist name a filter apply rather than a reload.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
Ardnived commentedon Oct 25, 2026
@sydevs-bot revise 1A
sydevs-bot commentedon Oct 25, 2026
🤖 no session running
recent dispatches
Written by the sydevs dispatcher. Sessions never edit this comment.
[-]fix(calendar): the Month toggle renders the day list on a phone[/-][+]fix(calendar): the view switch lights an option a phone cannot render[/+]sydevs-bot commentedon Oct 25, 2026
Applied 1A: Month registers
createViewMonthAgenda()below the crossing. Moved to## Decisions.Rewrote
## Approachfrom the pinned 2.36.0 build. Three corrections:controls.setView()only validates the name. The rewrite happens insetScreenSizeCompatibleView, at mount and at each breakpoint crossing, to the first registered compat view —listtoday.weekdeclareshasSmallScreenCompat: falsetoo, so Week lies on a phone from the same cause. Folded in.useCalendarPositionhas no persistence (src/config/store.ts:159), so a reload cannot reproduce a stale view. The criteria name a remount instead.New open question 2: what Week offers on a phone. SX ships no small-screen week, and
month-agendasurvives only whereisCalendarSmallis truthful, soweekcannot be emitted below the crossing. Recommended A — hide Week there.Title broadened; the fix is no longer Month-only. Type and Priority unchanged.
@sydevs-bot implementstarts the build, once 2 is answered.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
3 remaining items
sydevs-bot commentedon Oct 26, 2026
Not started: 1 open question(s) in the body still need an answer. Reply
@sydevs-bot revisewith your choices (for example1A), then say@sydevs-bot implementagain.🤖 sydevs dispatcher
Ardnived commentedon Oct 26, 2026
@sydevs-bot revise 2A
sydevs-bot commentedon Oct 27, 2026
Applied 2A: Week is hidden below the crossing. Moved to
## Decisions, and no open question remains.One correction from the pinned 2.36.0 build. The fix no longer pins SX's breakpoint through
isCalendarSmall— it setsisResponsive: false. The resize listener is registered only when that flag is on (core.js:2541), and it is the only path intosetScreenSizeCompatibleView, so nothing can rewrite the view mid-resize and the resolver becomes the only authority. The dropped signal has two readers, both in SX's own header, whichglobals.css:532hides.The resolver maps a stored
weektomonth-agendabelow the crossing and lights Month. The store keepsweek, so widening restores it.labelandstepread the resolved option too, or a phone pages by whole weeks over a month agenda.Type, title and Priority unchanged.
@sydevs-bot implementstarts the build.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
Ardnived commentedon Oct 27, 2026
@sydevs-bot implement