Make the availability picker usable on mobile - #4394
Open
chpy04 wants to merge 1 commit into
Open
Conversation
The availability grid was built for a 700px-wide desktop modal and was barely usable on a phone: the table forced horizontal scrolling, the percentage-based row heights collapsed to ~18px tall slots outside the fixed-height modal, the two grid controls were squeezed onto one line, and the fixed CANCEL/SAVE bar sat on top of the last row of slots. Every style change is gated behind the existing max-width:480px mobile check, so the desktop rendering is unchanged. - Fit the week to the viewport on phones instead of scrolling sideways: narrower time column, abbreviated day labels, smaller type, and a fixed 36px row height so slots stay tappable. - Stack the "Fill from busy times" / "Invert Availability" controls above the grid on narrow screens. - Swap the slot's mousedown/mouseup for pointerdown/pointerup so a tap registers directly rather than through emulated mouse events; drag to paint stays mouse-only, so touch scrolling over the grid is unaffected. - Add day-header and time-label toggles (fill or clear a whole column or row) as the touch replacement for click-and-drag. Available on desktop too, surfaced by the cursor and tooltip. - Give the mobile action bar a border, a safe-area inset, and matching bottom padding on the grid so it stops covering slots, and drop the 30px page title for the long "Update your availability for..." header. - Apply the same fit-to-width treatment to the read-only availability view. Also folds the repeated "write the map, then recompute the displayed week" block into a single commitAvailabilities helper. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015jsJ4vqxNeHzFTLe8s5KeE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
The availability grid (
EditAvailability) was built for the 700px-wide desktop modal, and on a phone it was close to unusable:minWidth: 700forced horizontal scrolling to reach the later days of the weekcalc((100% - 50px) / 12)) collapse to ~18px tall slots once the grid renders as a page instead of inside the fixed-height dialogWhat this changes:
mousedown/mouseuptopointerdown/pointerupso a tap registers directly rather than through emulated mouse events. Drag-to-paint stays mouse-only (setIsDragging(event.pointerType === 'mouse')) — see Notes.SingleAvailabilityView.Small cleanup along the way: the "write the map, then recompute the displayed week" block was repeated in three places and is now a single
commitAvailabilitieshelper.Notes
Desktop is deliberately untouched. Every style change is gated behind the existing
max-width:480pxcheck that this component already used, and the mobile-only values are applied with conditional spreads so desktop gets no declaration at all rather than one that restates a default. Verified by measurement and pixel diff — see Test Cases.Why drag-to-paint is still mouse-only. Making it work on touch requires
touch-action: noneon the slots, which would stop the page from scrolling anywhere over a 12-row grid. The day/time label toggles cover the same need (fill a day, fill an hour across the week) without taking scrolling away.The
Fill from busy timesandInvert Availabilitybulk actions are unchanged.Test Cases
Verified in Chromium against the real components:
Fill from busy timesbutton, and two runs of identical code produce the same diff there — it is thebusyTimesIsFetchingdisabled-state flicker, not this change.tsc --noEmitclean,prettier --checkclean,yarn buildpasses.yarn lintcould not be run in this environment — ESLint 7 crashes on Node 22 here (async-function/require.mjsESM error), unrelated to this diff. Worth a look on CI.Screenshots
I can't attach images from the environment this was written in, so the measurements above stand in for them — the desktop renders are pixel-compared against
developrather than eyeballed. Happy for a reviewer to grab the two required screenshots (normal window / smallest window) before merge, or I can describe exact repro steps.To Do
Closes # (issue #)
Generated by Claude Code