feat: add issue tracker metrics widget — open/closed issues trend #180#279
feat: add issue tracker metrics widget — open/closed issues trend #180#279zishanq7861 wants to merge 12 commits into
Conversation
|
@zishanq7861 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
|
The trend chart and weekly breakdown are good ideas, but a few correctness issues: 1. Wrong session field for username: // Replace:
const username = searchParams.get("username") || session.user?.name || "";
// With:
const username = searchParams.get("username") || session.githubLogin || "";
2. Authorization header format: // Replace:
headers: { Authorization: `token ${session.accessToken}` }
// With:
headers: { Authorization: `Bearer ${session.accessToken}` }3. 4. Fix these and push. |
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
Changes Required
1. [SECURITY] username query param allows fetching any user's data
const username = searchParams.get("username") || session.githubLogin || "";Any authenticated user can call /api/metrics/issues?username=other-user and get that user's issue stats. Remove the username param entirely — use only session.githubLogin:
const username = session.githubLogin;
if (!username) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });2. revalidate=300 conflicts with force-dynamic
export const dynamic = "force-dynamic" disables all caching. export const revalidate = 300 is silently ignored. Remove the revalidate line — it creates confusion.
3. Missing EOF newlines
Both route.ts and IssueMetrics.tsx end with } and no trailing newline. Add one to each.
4. Hardcoded Tailwind colors in IssueMetrics.tsx
text-blue-500 → text-[var(--accent)]
text-green-500 → text-[var(--success)]
text-red-500 → text-[var(--destructive)]
text-amber-500 → no direct CSS var; use text-[var(--accent)] or add --warning to globals.css5. useState<any> and catch (error: any)
const [data, setData] = useState<any>(null); // → typed interface
catch (error: any) { setError(error.message); } // → error instanceof Error ? error.message : "Failed"Define an explicit interface for the API response shape to enable type safety throughout the component.
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
Issues found in this PR:
-
Missing EOF newline — add a trailing newline to all modified files.
-
Raw Tailwind color classes — replace
text-red-*/bg-red-*withtext-[var(--destructive)]/ appropriate CSS var equivalents. All colors must use CSS variables for theme support. -
Raw green color classes — replace
text-green-*/bg-green-*withtext-[var(--success)]or appropriate CSS var.
|
This PR has merge conflicts with |
e3ef144 to
9aeda32
Compare
Closes #180
Implemented the Issue Tracker Metrics widget matching all acceptance criteria:
involvesfilter constraint.IssueMetricscomponent rendering total open, weekly open/closed stats, and average resolution velocity.