feat(repos): add sort options (stars/forks/recently updated) to Popular Repositories#203
feat(repos): add sort options (stars/forks/recently updated) to Popular Repositories#203Adit-Jain-srm wants to merge 2 commits into
Conversation
…ar Repositories (Closes PRODHOSH#144) Adds three pill-style sort buttons above the repo grid. Sorting is client-side using Array.sort() on a copy of the repos prop. Default is stars descending. Added pushed_at to GitHubRepo interface (already returned by GitHub REST API). Pill style matches DESIGN.md pill-tag-green/soft pattern. Signed-off-by: Adit Jain <aditjain2005@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughProfileView now lets “Popular repositories” be reordered on the client by stars, forks, or recent activity. The component tracks the selected sort mode in state, adds sort toggles in the section header, and renders the repositories from a sorted copy. ChangesPopular repositories sorting
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Could you add the elusoc label? Issue #144 has ELUSOC + ADVENTURER. Thanks! |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/profile/ProfileView.tsx`:
- Around line 812-830: The repo sort buttons in ProfileView behave like a
single-select toggle group, but the current active state is not exposed to
assistive tech. Update the button group rendered in ProfileView so it has a
clear label and each button reflects its selected state via aria-pressed, using
the existing repoSort and setRepoSort logic to keep the active mode announced by
screen readers.
- Around line 842-846: The sort in ProfileView is being applied after the repo
list has already been trimmed to six items, so Forks and Recent can only reorder
the existing star-biased subset. Move the top-6 cutoff out of the fetch path in
the [username] page so ProfileView receives the full repo list, then let
ProfileView’s repoSort-based sort run before any slicing; use the existing
ProfileView map block and the repos handling in the page component as the fix
points.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 85c8bed3-3ee4-4a0d-b1c2-b198f81d9a26
📒 Files selected for processing (1)
src/components/profile/ProfileView.tsx
Signed-off-by: Adit Jain <aditjain2005@gmail.com>
Summary
Adds sort controls to the Popular Repositories section so users can reorder by stars, forks, or most recently updated.
Related Issue
Closes #144
Type of Change
Changes Made
Single file:
src/components/profile/ProfileView.tsxpushed_at?: stringtoGitHubRepointerface (GitHub REST API always returns this field)repoSortstate variable (stars/forks/updated, defaults to stars)[...repos].sort()on a copy (never mutates the prop)AI Usage
The sort creates a shallow copy with spread to avoid mutating the prop.
pushed_atis an ISO date string solocaleComparegives correct chronological ordering. Stars/forks use numeric subtraction for descending sort.Screenshots (if UI change)
Three small pill buttons ("Stars" | "Forks" | "Recent") appear to the right of the "Popular repositories" heading. The active one is green, inactive ones are grey with a hairline border.
Checklist
mainconsole.logleft insrc/schema.sqland a new migration file are includedDESIGN.mdand followed the design system (colors, spacing, typography, components)feat:,fix:,docs:, etc.)Summary by CodeRabbit