Skip to content

feat: add estimated codebase size badge to top repositories card#2796

Open
harshitanagpal05 wants to merge 3 commits into
Priyanshu-byte-coder:mainfrom
harshitanagpal05:feat/codebase-complexity-badge
Open

feat: add estimated codebase size badge to top repositories card#2796
harshitanagpal05 wants to merge 3 commits into
Priyanshu-byte-coder:mainfrom
harshitanagpal05:feat/codebase-complexity-badge

Conversation

@harshitanagpal05

@harshitanagpal05 harshitanagpal05 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Description

Closes #2601

Adds a compact, non-intrusive codebase size badge (Small Codebase / Medium Codebase / Large Codebase) to each repository entry on the Top Repositories dashboard card. The classification is derived from the total language byte count already returned by the GitHub Languages API — no additional API calls are needed.

Thresholds

Total Language Bytes Label
< 50 KB Small Codebase
50 KB – 500 KB Medium Codebase
> 500 KB Large Codebase

Changes

New file: src/lib/codebase-size.ts

  • Pure helper utility with zero dependencies
  • getCodebaseSize(totalBytes) — maps raw byte count → "Small" | "Medium" | "Large"
  • getCodebaseSizeFromLanguages(languages[]) — convenience wrapper that sums bytes from an existing RepoLanguage[] array and returns the size category (or null when no language data is available)

Modified: src/components/TopRepos.tsx

  • Imports the new codebase size utility
  • Computes codebaseSize per repo inside the RepoItem component
  • Renders a color-coded pill badge inline with existing language pills (same flex flex-wrap container):
    • 🟢 Small — emerald-tinted badge
    • 🟡 Medium — amber-tinted badge
    • 🔵 Large — blue-tinted badge
  • Badge only renders when repo.languages has byte data (non-intrusive)
  • Includes descriptive aria-label and title attributes for accessibility

Acceptance Criteria

  • Visually non-intrusive metadata addition
  • Accessible aria-label attributes for screen readers describing repo size scale
  • No regression or layout breaking across mobile responsive views (uses existing flex-wrap)
  • No additional API calls — uses existing language byte data
  • Lint clean (eslint)
  • Type-check clean (tsc --noEmit)

Feature Area

Goal Tracker — Top Repositories Card

…iyanshu-byte-coder#2601)

- Add pure utility (src/lib/codebase-size.ts) mapping total language bytes
  to Small (<50KB) / Medium (50-500KB) / Large (>500KB) categories
- Render color-coded badge alongside language pills in TopRepos component
- Include accessible aria-labels for screen readers
- Non-intrusive: badge only appears when language byte data is available
@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature type:bug GSSoC type bonus: bug fix type:design GSSoC type bonus: UI/design (+10 pts) type:performance GSSoC type bonus: performance (+15 pts) and removed gssoc26 GSSoC 2026 contribution labels Jun 25, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@github-actions github-actions Bot added the gssoc26 GSSoC 2026 contribution label Jun 25, 2026
@harshitanagpal05 harshitanagpal05 changed the title feat: add codebase complexity hint badge to top repositories card feat: add estimated codebase size badge to top repositories card Jun 25, 2026
@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

Thanks for contributing! We are currently in a code cleanup sprint and not accepting new features. Please see: #2651

This PR will be revisited once the sprint ends. Tests, refactors, bug fixes, and documentation are welcome in the meantime.

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

Labels

gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:design GSSoC type bonus: UI/design (+10 pts) type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Add "Estimated Reading Time / Code Complexity Hint" to top repositories card

2 participants