Skip to content

Feat: Added commit diff size trend [ISSUE: #174]#390

Open
abdullahxyz85 wants to merge 14 commits into
Priyanshu-byte-coder:mainfrom
abdullahxyz85:feat/commit-diff-size-trend
Open

Feat: Added commit diff size trend [ISSUE: #174]#390
abdullahxyz85 wants to merge 14 commits into
Priyanshu-byte-coder:mainfrom
abdullahxyz85:feat/commit-diff-size-trend

Conversation

@abdullahxyz85
Copy link
Copy Markdown
Contributor

Summary [ISSUE: #174 ]

Adds a stacked bar chart showing lines added vs. removed per week over the last 12 weeks, giving insight into codebase growth patterns.

What's Changed

  • New DiffTrendChart component in dashboard
  • API endpoint to fetch repository code frequency stats
  • Aggregates data from top 3 repositories
  • Stacked bar chart with lines added (green) and removed (red)
  • Handles GitHub 202 response (computing stats state)
  • Added CSS color variables for theme consistency

Implementation Details

  • Fetches from GitHub API: /repos/{owner}/{repo}/stats/code_frequency
  • Displays last 12 weeks of data
  • Shows loading, computing, and error states
  • Responsive design for all screen sizes
  • Full dark mode support

Acceptance Criteria Met: ISSUE: #174

  • ✅ New chart widget in dashboard
  • ✅ Data from GitHub Stats API
  • ✅ Aggregated across top 3 repos
  • ✅ Stacked bar with additions/deletions
  • ✅ Uses recharts BarChart with two data series
  • ✅ Last 12 weeks shown with dates
  • ✅ Tooltip shows exact counts
  • ✅ Handles 202 response (Computing stats)
  • ✅ Uses CSS variables for colors

Visual Overview:

Code Change Trend:

image

Closes: #174

@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

@abdullahxyz85 is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

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

API route and chart component look clean. Two issues:

1. cursor={{ fill: "var(--accent)/10" }} is invalid
In DiffTrendChart.tsx, the recharts cursor prop passes fill: "var(--accent)/10" as an SVG attribute — var(--accent)/10 is Tailwind shorthand syntax, not valid CSS/SVG. SVG will ignore it (no fill applied). Replace with a transparent or semi-transparent value:

cursor={{ fill: "rgba(99, 102, 241, 0.1)" }}

Or just omit the cursor prop to use recharts default.

2. DiffTrendChart not registered in dashboard/page.tsx
The chart component is created but never imported or rendered anywhere. Add it to the dashboard page (inside the grid of widgets) so it actually appears.

@abdullahxyz85
Copy link
Copy Markdown
Contributor Author

abdullahxyz85 commented May 19, 2026

@Priyanshu-byte-coder Done! Please make sure to add the label: gssoc:approved and level:adavanced.

Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

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

  1. accountId used as github_login — getUserTopRepos(token, accountId) passes the numeric GitHub ID string for non-primary accounts, not the login. users//repos will fail. Look up github_login from DB first. 2. Deletions not abs() — GitHub code_frequency returns negative integers for deletions. Apply Math.abs() before charting or bars render below axis. 3. Hardcoded cursor color — rgba(99, 102, 241, 0.1) is hardcoded indigo. Use a CSS var. 4. No caching — wrap in withMetricsCache; 3 stats API calls per load hits secondary rate limits.

@Priyanshu-byte-coder Priyanshu-byte-coder added level:intermediate GSSoC: Intermediate difficulty (35 pts) gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature labels May 20, 2026
Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

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

This PR has merge conflicts with main. Please rebase on the latest main branch and force-push to resolve:

git fetch origin
git rebase origin/main
git push --force-with-lease

@github-actions github-actions Bot added the type:design GSSoC type bonus: UI/design (+10 pts) label May 21, 2026
@abdullahxyz85 abdullahxyz85 force-pushed the feat/commit-diff-size-trend branch from d101b4c to b573393 Compare May 22, 2026 02:43
abdullahxyz85 and others added 9 commits May 22, 2026 07:48
Skeleton loaders on the dashboard were silent for screen-reader users —
no announcement during fetch and no signal when content arrived. Each
widget's skeleton block now exposes a polite live region so assistive
tech can describe loading state without visual or behavioral changes.

For every widget skeleton:
- Wrapper element gets role="status", aria-live="polite", aria-busy="true".
- A visually hidden <span class="sr-only">Loading [widget]</span> provides
  the accessible name (reuses Tailwind's built-in sr-only utility, matching
  existing usage in src/app/dashboard/settings/page.tsx).
- Each decorative pulse <div> gets aria-hidden="true" so only the status
  message is announced, not the placeholders themselves.

Completion is communicated implicitly: when loading flips false the
status region unmounts and the real content (with its existing heading)
renders. No explicit "loaded" announcement is added, which avoids a
cascade of overlapping ready messages as 13 widgets finish at different
times.

Closes Priyanshu-byte-coder#324.
… replace Tailwind syntax with valid rgba and register chart component in dashboard
@abdullahxyz85 abdullahxyz85 force-pushed the feat/commit-diff-size-trend branch from b573393 to 9b12996 Compare May 22, 2026 02:53
@abdullahxyz85
Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder Now all the things are fixed , u can merge it easily , please make sure to add the label: gssoc:approved.

Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

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

Two issues, plus now conflicting:

  1. Conflicting with mainglobals.css changes conflict with recent merges. Please rebase:
    git fetch upstream
    git rebase upstream/main
    git push --force-with-lease
    
  2. After rebase, remove duplicate --success and --destructive additions to globals.css — these vars are already defined in main. Remove the additions and just use var(--success) and var(--destructive).
  3. Raw Tailwind red colorsborder-red-500/20, bg-red-500/10, text-red-400, border-red-500/30, text-red-300, hover:bg-red-500/10 → replace with var(--destructive)

@abdullahxyz85
Copy link
Copy Markdown
Contributor Author

Two issues, plus now conflicting:

  1. Conflicting with mainglobals.css changes conflict with recent merges. Please rebase:
    git fetch upstream
    git rebase upstream/main
    git push --force-with-lease
    
  2. After rebase, remove duplicate --success and --destructive additions to globals.css — these vars are already defined in main. Remove the additions and just use var(--success) and var(--destructive).
  3. Raw Tailwind red colorsborder-red-500/20, bg-red-500/10, text-red-400, border-red-500/30, text-red-300, hover:bg-red-500/10 → replace with var(--destructive)

Conflicts resolved and things implemented, now u can merge it easily ! @Priyanshu-byte-coder

@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

Merge conflict with current main. Please rebase against main to resolve before this can be merged.

@Priyanshu-byte-coder Priyanshu-byte-coder added the gssoc:approved GSSoC: PR approved for scoring label May 24, 2026
@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

This PR has merge conflicts with main. Please rebase on the latest main branch and re-request review. The approach is approved — just needs conflict resolution.

@abdullahxyz85
Copy link
Copy Markdown
Contributor Author

abdullahxyz85 commented May 24, 2026

@Priyanshu-byte-coder Conflicts resolved , now u can merge it easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC: PR approved for scoring gssoc26 GSSoC 2026 contribution level:intermediate GSSoC: Intermediate difficulty (35 pts) type:design GSSoC type bonus: UI/design (+10 pts) type:feature GSSoC type bonus: new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Add commit diff size trend — lines added/removed per week chart

4 participants