Skip to content

Fix/prmetrics empty state#394

Open
mrunalC27 wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
mrunalC27:fix/prmetrics-empty-state
Open

Fix/prmetrics empty state#394
mrunalC27 wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
mrunalC27:fix/prmetrics-empty-state

Conversation

@mrunalC27
Copy link
Copy Markdown
Contributor

@mrunalC27 mrunalC27 commented May 19, 2026

Summary

Adds a proper empty state to the PR Analytics section when a user has no pull requests instead of showing empty metrics and charts.

Closes #215

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup

Changes Made

  • Added a zero-state check using metrics?.total === 0
  • Added a user-friendly empty state message for users with no PRs
  • Used var(--muted-foreground) styling to match existing UI patterns
  • Updated the PRData interface to include the total field

How to Test

Steps for the reviewer to verify this works:

  1. Run the application locally
  2. Open the PR Analytics section with an account that has no pull requests
  3. Verify that the empty state message appears instead of empty charts/cards
  4. Verify that accounts with PR data still display analytics correctly

Screenshots (if UI change)

Added empty state UI for users with no pull requests.

Checklist

  • Linked issue in summary
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Self-reviewed the diff
  • Added/updated tests if applicable

@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

@mrunalC27 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.

Two issues:

1. This PR includes #325's DashboardHeader.tsx changes
The DashboardHeader changes are already being reviewed in #325. Once #325 merges, rebase this PR on main so only the PRMetrics empty-state diff remains. Don't merge this before #325 merges (or it would land both sets of changes at once, making the history harder to read).

2. Indentation inconsistency in the empty-state ternary

      ) : (
-       <div className="grid ...
// becomes
        ) : metrics?.total === 0 ? (
          <div className="flex ...

The ) : moved from 6-space to 8-space indent and the content from 8 to 10. Match the surrounding ternary branches' indentation.

@mrunalC27
Copy link
Copy Markdown
Contributor Author

fixed 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.

1. total field not returned by the API — the component checks metrics?.total === 0 but /api/metrics/prs doesn't return a total field. The empty state will never render because metrics.total will be undefined, not 0. Update the API route to return total as well.

2. JSX indentation is malformed — the new ternary branch and the <div className="grid"> inside it are indented inconsistently (mixed 10-space and 12-space). Fix to match the surrounding 8-space indent — or run Prettier.

@Priyanshu-byte-coder Priyanshu-byte-coder added level:beginner GSSoC: Beginner difficulty (20 pts) gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix labels May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution level:beginner GSSoC: Beginner difficulty (20 pts) type:bug GSSoC type bonus: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GOOD FIRST ISSUE] Add empty state to PRMetrics widget when user has zero PRs

2 participants