feat: Add repo pinning — pin up to 3 repos in TopRepos #221#302
feat: Add repo pinning — pin up to 3 repos in TopRepos #221#302pawanakapkv wants to merge 5 commits into
Conversation
|
@pawanakapkv 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. |
There was a problem hiding this comment.
Thanks for your first PR on DevTrack! 🎉
A maintainer will review it within 48 hours. While you wait:
- Make sure CI is passing (type-check + lint)
- Double-check the PR description is filled out and the issue is linked
- Feel free to ask questions in Discussions if you need help
|
Good feature — DB migration with constraint, optimistic update, 3-pin limit at both API and DB layer. A few things to fix before merge: Conflict: PR #303 (sortable columns) just merged and touched Hardcoded colors to replace with CSS vars: // pin icon className — replace:
className={isPinned ? "text-blue-500" : "text-gray-400"}
// with:
className={isPinned ? "text-[var(--accent)]" : "text-[var(--muted-foreground)]"}
// Pinned badge — replace bg-blue-500/10, text-blue-400, ring-blue-500/20:
className="ml-2 inline-flex items-center rounded-md bg-[color-mix(in_srgb,var(--accent)_10%,transparent)] px-1.5 py-0.5 text-[10px] font-medium text-[var(--accent)] ring-1 ring-inset ring-[color-mix(in_srgb,var(--accent)_20%,transparent)] align-middle"Minor: Add aria-label={isPinned ? `Unpin ` : `Pin `}Fix these and push — will merge. |
825a105 to
a9afc89
Compare
|
Thanks for the excellent feedback! I have resolved the conflicts and updated the implementation according to your recommendations. Here is what has been updated:
All local lints and type checks pass cleanly ( |
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
Changes Required
1. Replace alert() with inline error state
alert("Maximum 3 pins allowed") uses the native browser dialog which is jarring in a modern UI and blocks the main thread. Use an inline error message instead:
const [pinError, setPinError] = useState<string | null>(null);
// In togglePin:
if (pinnedRepos.length >= 3) {
setPinError("Maximum 3 pins allowed");
return;
}
setPinError(null);
// In JSX (near the widget header):
{pinError && (
<p className="text-xs text-[var(--destructive)]">{pinError}</p>
)}2. Record<string, any> in settings/route.ts
const updates: Record<string, any> = {};Use a typed interface:
const updates: { is_public?: boolean; pinned_repos?: string[] } = {};The overall implementation is solid — optimistic UI with rollback, backend + DB-level 3-pin validation, and correct pin-first sort ordering. Address the two items above and this is ready to merge.
|
Hey @Priyanshu-byte-coder! 👋 Just a quick heads-up that I've pushed the requested changes for the pinning feature and merged the latest Could you please take another look when you have a moment? Let me know if there are any other adjustments you need me to make, or if we are good to merge! 🚀 |
Summary
Resolves #221
This PR implements the "Repo Pinning" feature in the
TopReposwidget, allowing users to pin up to 3 of their repositories so they always appear at the top of the list for permanent visibility.Closes #221
Type of Change
Changes Made
TopRepos.tsx):pinnedReposstate hooked up to/api/user/settingsviaGETto load existing pins.route.ts):/api/user/settingsGETendpoint to include thepinned_reposcolumn.PATCHendpoint to use a dynamic update payload, successfully processing updates forpinned_reposandis_publicindependently. Added validation for the 3-pin limit on the backend.20260518000000_add_pinned_repos_to_users.sql) to add thepinned_repostext[]column to theuserstable, including a DB-level constraint to ensure a maximum of 3 pins.How to Test
Steps for the reviewer to verify this works:
pinned_reposcolumn to your database.TopReposwidget is displayed.Screenshots (if UI change)
Dark Mode:



Max Alert:

Light Mode:



Checklist
npm run lintpasses locallynpm run type-check)