Fix "Real Info" and Ultimate 830px Profile Dashboard.#19
Merged
Conversation
- Fixed contribution graph scraping in `src/github.js` to accurately extract counts from tooltips and support new `<rect>` elements. - Increased data fetching depth for PRs, repos, and stars to ensure comprehensive "Real Info". - Re-implemented the Mastercard as an Ultimate 830px wide Profile Dashboard. - Standardized Issues and PR summary cards as "Lite Small" (380x120px). - Fixed text overlap in PR cards using dynamic SVG character measurement. - Enhanced robustness across all cards with `safeFetch` and individual error fallbacks. - Updated documentation and landing page with new dashboard examples. Co-authored-by: Chintanpatel24 <216989679+Chintanpatel24@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR improves the accuracy and depth of GitHub data fetched by src/github.js: it extracts per-day contribution counts directly from tooltip HTML (rather than estimating from data-level), supports the new SVG <rect> cell markup in addition to legacy <td>, and paginates user PRs and repo stars to surface a more complete "Real Info" picture. The PR description also references substantial card-layout/dashboard/README updates, but the diff itself only touches src/github.js.
Changes:
- Paginate
fetchUserPullRequests(up to 3 pages) andfetchUserTotalStars(up to 3 pages); raise defaultsafeFetchtimeout to 12s andfetchRecentPRLinesChangedmaxPRsto 10. - Rework
parseContributionHTMLto capture each cell'sidand resolve per-day counts from<tool-tip>elements, falling back tolevel * 2when no tooltip is found. - Minor cleanup: remove stale comments on
fetchUserLanguagesmock note and on thefetchUserLanguagesByCommitsproxy.
Comments suppressed due to low confidence (1)
src/github.js:215
fetchRecentPRLinesChangeddoubledmaxPRsfrom 5 to 10, and these requests are issued sequentially withawaitinside the loop. For unauthenticated GitHub requests this noticeably increases latency and risk of hitting rate limits. Consider issuing the per-PR fetches in parallel withPromise.all(still bounded bymaxPRs), which preserves the bound while keeping latency closer to a single request.
async function fetchRecentPRLinesChanged(prs, maxPRs = 10) {
const targetPRs = (prs || []).filter((pr) => pr?.pull_request?.url).slice(0, maxPRs);
if (targetPRs.length === 0) return 0;
let totalChanged = 0;
for (const pr of targetPRs) {
const data = await safeFetch(pr.pull_request.url, {}, 3000);
if (data) {
totalChanged += (data.additions || 0) + (data.deletions || 0);
}
}
return totalChanged;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * Robust fetch wrapper with timeout and better error handling | ||
| */ | ||
| async function safeFetch(url, options = {}, timeout = 10000) { | ||
| async function safeFetch(url, options = {}, timeout = 12000) { |
| async function fetchUserLanguagesByRepos(username) { | ||
| return await fetchUserLanguages(username); | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
src/github.jsto accurately extract counts from tooltips and support new<rect>elements.safeFetchand individual error fallbacks.