Repository navigation
feat: show a half-year activity grid on profiles under six months old - #1657
nunomaduro merged 10 commits into
Conversation
…th cannot spill past it
…h straight to half a year
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Updated |
Summary
A profile's commit activity graph shows a 30-day strip until the person's first visible commit is 30 days old. After that it switches to the full 53-week year grid. For anyone between one and six months in, that grid is mostly empty weeks, with their whole history squeezed into the last few columns.
Profiles whose first visible commit is 30 days to 6 months old now get a 26-week grid instead. It's laid out like the year grid, with fewer, larger squares. The header reads "N commits in the last 6 months". Under 30 days and over 6 months are unchanged.
I first tried a 3-month grid as well as the 6-month one. The 3-month grid didn't look good next to the wider views, so I added only the 6-month option.
Changes
ActivityScale::Half('half') starts atsubWeeks(25)->startOfWeek(SUNDAY), giving 26 columns and mirroringYear's 52/53.since()now tries Day, Week, Month, Half, then falls back to Year, so the choice is still based on the viewer's earliest visible commit.WeekGrid, used for bothhalfandyear. The half grid is capped at 26 × 1.5rem plus the weekday labels, so its squares can't balloon on a wide card. It has nomin-w-136, so it fits phone widths without scrolling.GET /api/v1/users/{handle}still returnsyearfor anyone past 30 days, exactly as before. Apps and TUIs readactivity.scaleand may not handle a new value, soApi\UserControllerasksUserActivityQueryto choose only from day, week and month, falling back to year.halfreaches API clients in a separate follow-up PR, which drops that argument once they support it.ShowSiteActivityRequestnow rejectshalf. The moderation bulk page was already limited to day, week and month.CreateUserActivityGraph) still draws the full year.Validation
All run locally. Hosted CI hasn't run yet: GitHub is holding the
testsandLint pull request titleworkflows until a maintainer approves running them on a PR from a fork.391c2f92:composer test:unit: 6514/6514 passed, with 100% line coverage.composer test:types,composer test:type-coverageandcomposer test:lint: passed.e3b1cce4(the head), which keeps the API onyear:composer test:unit: Pest 6515/6515 passed, with 100% line coverage. The Node unit tests passed 331/331.composer test:lint,composer test:typesandcomposer test:type-coverage(100%): passed.year(369 daily buckets) for a 2-month-old profile.halfisn't among the scales offered.half.Visual evidence
Local dev server with seeded profiles, base
production(90f528e) against this branch. Captured with headless Chrome, 1280px and 390px viewports, light and dark. Each image shows before on the left and after on the right.@shot-10d@shot-2mo@shot-4mo@shot-14mo@nunomaduro(local copy)2 months in, 1280px, dark
4 months in, 1280px, light
2 months in, 390px, dark
Unchanged: under 30 days and over 6 months
Real-world example (a local copy of @nunomaduro's profile, 1280px, dark)
Device verification
Phone width was checked only with viewport emulation (headless Chrome at 390px), not on a real device or simulator. At 390px the 26-week grid fits the card with no horizontal scroll. The change has no inputs or touch interactions. The graph is display-only, apart from the existing hover tooltips.
Independent review
Separate reviewers, not the implementer, ran read-only reviews of two revisions.
90f528e2..391c2f92(the full net diff): the reviewer checked the captures above, plus fresh captures and DOM measurements from a running preview of the head.391c2f92..e3b1cce4(keeping the API onyear), checked against the net diff from90f528e2:productionfor every profile age, including the signup-date fallback, and never returnshalf. The web profile and the README embed are unchanged.391c2f92.$scalesmust be smallest first. Only theFITTINGdocblock says so.Limitations
halfthrough/api/v1. I excluded it here because app behaviour is unknown if it's not designed to handle thehalfoption yet, so I want to make sure app developers have time to prepare for it.Summary by CodeRabbit