Skip to content

feat: add empty state to StreakTracker when no contribution data#277

Open
srinidhi-2006-bit wants to merge 8 commits into
Priyanshu-byte-coder:mainfrom
srinidhi-2006-bit:feat/streaktracker-empty-state
Open

feat: add empty state to StreakTracker when no contribution data#277
srinidhi-2006-bit wants to merge 8 commits into
Priyanshu-byte-coder:mainfrom
srinidhi-2006-bit:feat/streaktracker-empty-state

Conversation

@srinidhi-2006-bit
Copy link
Copy Markdown
Contributor

Summary

Added a friendly empty state to StreakTracker when contribution data is unavailable to improve user experience and avoid displaying misleading empty statistics.

Closes #204

Type of Change

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

Changes Made

  • Added empty-state UI when contribution data is missing
  • Added informative message and GitHub link
  • Preserved layout height to avoid visual shifts
  • Used project CSS variables for styling consistency
  • Added secure external link handling

How to Test

  1. Open the StreakTracker component
  2. Simulate empty or missing contribution data
  3. Verify the empty-state message appears
  4. Verify the GitHub button opens correctly
  5. Confirm layout spacing remains stable

Screenshots (if UI change)

N/A

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 17, 2026

@srinidhi-2006-bit 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.

@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

Good empty state! One small fix — the CTA button text uses text-[var(--background)] which would be invisible in light mode (white text on light background). Use text-[var(--accent-foreground)] instead:

className="mt-4 rounded-md bg-[var(--accent)] px-4 py-2 text-sm font-medium text-[var(--accent-foreground)] transition-opacity hover:opacity-90"

Fix and push — will merge.

@srinidhi-2006-bit
Copy link
Copy Markdown
Contributor Author

Updated the CTA button text color to use text-[var(--accent-foreground)] for proper visibility across both light and dark themes.

Pushed the requested fix. Thank you for the review!

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.

CSS vars are now correct. One formatting fix needed:

Indentation of the new if block
The block uses 4-space indentation for the outer if, inconsistent with the rest of the file which uses 2 spaces:

// current (wrong indentation)
    if (
    !contributionData ||

// should be
  if (
    !contributionData ||

Also remove the blank line that was deleted before the block (the diff removes a \n that should stay). After fixing indentation this is ready to merge.

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. Add blank line before const MILESTONES — closing } of the empty-state block and the constant declaration are jammed together.

2. Edge case — the check Object.keys(contributionData.data).length === 0 misses users who have data keys but all values are 0. Consider also guarding on contributions.total === 0, or document why you don't.

3. Checklist incomplete — confirm npm run lint and npm run type-check pass locally before resubmitting.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature labels May 20, 2026
@srinidhi-2006-bit
Copy link
Copy Markdown
Contributor Author

Fixed the requested changes:

  • Added proper blank line before const MILESTONES for consistent formatting
  • Improved empty-state condition to also handle cases where contribution values are all 0
  • Verified both npm run lint and npm run type-check pass locally

Thanks for the detailed review!

@Priyanshu-byte-coder Priyanshu-byte-coder added the level:beginner GSSoC: Beginner difficulty (20 pts) label 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:feature GSSoC type bonus: new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GOOD FIRST ISSUE] Add empty state to StreakTracker when no contribution data

2 participants