Skip to content

fix: contribution graph enhancements#292

Merged
ping-maxwell merged 10 commits intobetter-auth:mainfrom
Cyberistic:contribution-graph-enhancement
Apr 9, 2026
Merged

fix: contribution graph enhancements#292
ping-maxwell merged 10 commits intobetter-auth:mainfrom
Cyberistic:contribution-graph-enhancement

Conversation

@Cyberistic
Copy link
Copy Markdown
Contributor

@Cyberistic Cyberistic commented Mar 4, 2026

All changes for mobile:

  • Improved contribution graph
  • split year into two halves and added button; since the full year doesn't fit on screen
  • Added visual indicator for selected day since thumb hides it
  • Logic for sliding effect
  • Locked vertical scroll when sliding

preview_2026-03-05_02-48-52.gif

I also experimented with adding haptics but couldn't figure out how to reliably fire it on slide so I let go of this for now.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 4, 2026

@Cyberistic is attempting to deploy a commit to the better-auth Team on Vercel.

A member of the Team first needs to authorize it.

@Cyberistic Cyberistic marked this pull request as ready for review March 4, 2026 23:54
Copilot AI review requested due to automatic review settings March 4, 2026 23:54
Copy link
Copy Markdown

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 PR improves the mobile UX of the user profile page, focusing on making the contribution graph usable on small screens (half-year toggle, touch/slide interaction, selected-day indicator) and tightening mobile layout for repository browsing.

Changes:

  • Enhance ContributionChart for mobile: half-year toggle, held/slide interaction with tooltip positioning, and scroll locking during drag.
  • Adjust user profile repositories UI for mobile (full-width tab switcher, mobile filter/sort row, improved repo row layout).
  • Update contributor setup docs to use bunx for Prisma, and add a placeholder Prisma migration to match an already-applied migration ID.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
apps/web/src/components/users/user-profile-content.tsx Mobile layout refinements for profile sidebar/main content and repository list/filter UX.
apps/web/src/components/dashboard/contribution-chart.tsx Mobile contribution graph interaction enhancements (half-year toggle, held tooltip, sliding).
apps/web/prisma/migrations/20260228005751_init/migration.sql Adds an empty migration to satisfy Prisma’s applied-migrations tracking.
CONTRIBUTING.md Switch Prisma commands from npx to bunx to match Bun-first workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}, 130);
}, [isHalfTransitioning, isMobile]);

useEffect(() => {
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toggleHalfYear schedules a timeout via halfTransitionTimeoutRef, but the timeout is never cleared on unmount. If the component unmounts (route change) during the 130ms delay, the callback can still run and call setHalfYear / setIsHalfTransitioning, causing state updates after unmount. Add an effect cleanup to clear any pending timeout (and optionally clear it inside clearHeldCell / before unmount).

Suggested change
useEffect(() => {
useEffect(() => {
return () => {
if (halfTransitionTimeoutRef.current !== null) {
window.clearTimeout(halfTransitionTimeoutRef.current);
halfTransitionTimeoutRef.current = null;
}
};
}, []);
useEffect(() => {

Copilot uses AI. Check for mistakes.
Comment on lines +498 to +505
<div ref={scrollContainerRef}>
<div
className="inline-grid pt-0"
className={cn(
"inline-grid pt-0 transition-opacity duration-200",
isHalfTransitioning
? "opacity-0"
: "opacity-100",
)}
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The chart container no longer has overflow-x-auto (now just <div ref={scrollContainerRef}>). On smaller desktop widths (or constrained containers), the full-year grid can exceed the available width and will overflow instead of being horizontally scrollable. Consider restoring horizontal overflow scrolling (potentially conditionally) so the layout doesn’t break when the grid is wider than its container.

Copilot uses AI. Check for mistakes.
Comment on lines +674 to +678
onContextMenu={(
e,
) =>
e.preventDefault()
}
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onContextMenu is always prevented for contribution cells. This blocks the standard right‑click context menu on desktop (copy, inspect, accessibility tools) even though the mobile long‑press behavior is the main concern. Consider only preventing the context menu on touch devices / when a non-mouse pointer interaction is active.

Suggested change
onContextMenu={(
e,
) =>
e.preventDefault()
}
onContextMenu={(e) => {
const isTouchLike =
(typeof window !==
"undefined" &&
window
.matchMedia &&
window
.matchMedia(
"(pointer: coarse)",
).matches) ||
(typeof navigator !==
"undefined" &&
(navigator.maxTouchPoints ||
0) > 0);
if (isTouchLike) {
e.preventDefault();
}
}}

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +7
This file was added to keep backwards compatibility with older versions without dropping the whole database. No idea how it appeared in the first place.
Deleting the folder gives the following prisma error:
- The following migration(s) are applied to the database but missing from the local migrations directory: 20260228005751_init
- You may use prisma migrate reset to drop the development database.
- All data will be lost.
If you can figure out how to delete this folder, please do.
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This migration file is intentionally empty, but the comment reads like a temporary note (“No idea how it appeared… If you can figure out how to delete this folder, please do.”). Since migrations are long-lived artifacts, replace this with a clear, actionable explanation of why the migration must exist (e.g., referenced in _prisma_migrations) and what the recommended remediation is, without open-ended instructions.

Suggested change
This file was added to keep backwards compatibility with older versions without dropping the whole database. No idea how it appeared in the first place.
Deleting the folder gives the following prisma error:
- The following migration(s) are applied to the database but missing from the local migrations directory: 20260228005751_init
- You may use prisma migrate reset to drop the development database.
- All data will be lost.
If you can figure out how to delete this folder, please do.
This migration file is intentionally empty and is retained to preserve Prisma's migration history.
The migration "20260228005751_init" has been recorded as applied in the database (for example,
in the `_prisma_migrations` table or equivalent metadata). Removing this directory or file
while it is still referenced by the database causes Prisma to report an error such as:
- The following migration(s) are applied to the database but missing from the local migrations directory: 20260228005751_init
Do NOT delete this file or its containing folder in environments where the corresponding
migration is recorded as applied. If this migration is no longer needed, the recommended
remediation is to perform a controlled reset of the database (for example, using
`prisma migrate reset`) in a non-production environment, understanding that all data will
be lost. In production environments, keep this file to maintain a consistent migration history.

Copilot uses AI. Check for mistakes.
@Cyberistic Cyberistic changed the title Contribution graph enhancements feat: contribution graph enhancements Mar 5, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
better-hub Ready Ready Preview, Comment Mar 5, 2026 6:55pm

Request Review

@ping-maxwell
Copy link
Copy Markdown
Member

Hey could you fix merge conflicts? Thanks

@Cyberistic
Copy link
Copy Markdown
Contributor Author

@ping-maxwell done

@ping-maxwell ping-maxwell changed the title feat: contribution graph enhancements fix: contribution graph enhancements Apr 9, 2026
Copy link
Copy Markdown
Member

@ping-maxwell ping-maxwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work

@ping-maxwell ping-maxwell merged commit 033564d into better-auth:main Apr 9, 2026
4 of 5 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.

3 participants