Repository navigation
feat(docs): add Hall of Fame contributor page #679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
08abhinav
wants to merge
10
commits into
Ryan-Millard:dev
Choose a base branch
from
08abhinav:docs/hall-of-fame
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
783a799
feat(docs): add Hall of Fame contributor page
08abhinav 7998b48
refactor(docs): rename hall-of-fame page to kebab-case and list all c…
08abhinav 41c0582
refactor(docs): rename hall-of-fame page and list all contributors
08abhinav 957f5c1
fix(docs): correct hall-of-fame data import path
08abhinav 3c9552f
Merge branch 'dev' into docs/hall-of-fame
Ryan-Millard 485c362
feat(docs): update hall of fame entries and improve responsive card l…
08abhinav ecba3b9
fix: fix my own mistakes during previous review
Ryan-Millard 9440e98
Merge branch 'dev' into docs/hall-of-fame
Ryan-Millard 4b7b06c
chore(format): format all files
Ryan-Millard 82e2100
Merge branch 'dev' into docs/hall-of-fame
Krasner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| /* | ||
| *IMPORTANT: GitHub rate limits unauthenticated requests, so | ||
| *this may break during development. To fix it, authenticate manually | ||
| */ | ||
|
|
||
| import hallOfFameInput from "../src/data/hall-of-fame.json"; | ||
|
|
||
| const REPO = "Ryan-Millard/Img2Num"; | ||
| const API = "https://api.github.com"; | ||
| const PER_PAGE = 50; | ||
| const MAX_PAGES = 10; | ||
|
|
||
| const isBot = (user) => user?.type === "Bot" || user?.login?.endsWith("[bot]"); | ||
|
|
||
| const withAvatarSize = (url) => (url ? `${url}${url.includes("?") ? "&" : "?"}s=96` : null); | ||
|
|
||
| async function fetchAllContributors(headers) { | ||
| const all = []; | ||
|
|
||
| try { | ||
| for (let page = 1; page <= MAX_PAGES; page++) { | ||
| const res = await fetch(`${API}/repos/${REPO}/contributors?per_page=${PER_PAGE}&page=${page}`, { headers }); | ||
| if (!res.ok) break; | ||
|
|
||
| const batch = await res.json(); | ||
| if (!Array.isArray(batch) || batch.length === 0) break; | ||
|
|
||
| all.push(...batch); | ||
| if (batch.length < PER_PAGE) break; | ||
| } | ||
| } catch {} | ||
|
|
||
| return all | ||
| .filter((c) => !isBot(c)) | ||
| .map((c) => ({ | ||
| username: c.login, | ||
| avatarUrl: withAvatarSize(c.avatar_url), | ||
| profileUrl: c.html_url, | ||
| contributions: c.contributions, | ||
| })); | ||
| } | ||
|
|
||
| async function fetchFeaturedMember(entry, headers) { | ||
| const fallback = { | ||
| username: entry.username, | ||
| name: entry.username, | ||
| avatarUrl: null, | ||
| profileUrl: `https://github.com/${entry.username}`, | ||
| year: entry.year, | ||
| blurb: entry.blurb || "", | ||
| mergedPRCount: null, | ||
| recentPRs: [], | ||
| }; | ||
|
|
||
| try { | ||
| const userRes = await fetch(`${API}/users/${entry.username}`, { headers }); | ||
| if (!userRes.ok) return fallback; | ||
|
|
||
| const userData = await userRes.json(); | ||
| if (isBot(userData)) return null; | ||
|
|
||
| const user = { | ||
| ...fallback, | ||
| username: userData.login || entry.username, | ||
| name: userData.name || userData.login || entry.username, | ||
| avatarUrl: withAvatarSize(userData.avatar_url), | ||
| profileUrl: userData.html_url || fallback.profileUrl, | ||
| }; | ||
|
|
||
| const searchUrl = `${API}/search/issues?q=repo:${REPO}+type:pr+author:${entry.username}+is:merged&sort=created&order=desc&per_page=5`; | ||
| const prRes = await fetch(searchUrl, { headers }); | ||
|
|
||
| if (prRes.ok) { | ||
| const prData = await prRes.json(); | ||
| user.mergedPRCount = prData.total_count ?? 0; | ||
| user.recentPRs = (prData.items || []).map((pr) => ({ | ||
| title: pr.title, | ||
| url: pr.html_url, | ||
| number: pr.number, | ||
| })); | ||
| } | ||
|
|
||
| return user; | ||
| } catch { | ||
| return fallback; | ||
| } | ||
| } | ||
|
|
||
| export async function fetchHallOfFameData({ token } = {}) { | ||
| const headers = { | ||
| "User-Agent": "Img2Num-Docs", | ||
| Accept: "application/vnd.github+json", | ||
| ...(token ? { Authorization: `Bearer ${token}` } : {}), | ||
| }; | ||
|
|
||
| const [contributors, featuredRaw] = await Promise.all([fetchAllContributors(headers), Promise.all(hallOfFameInput.map((e) => fetchFeaturedMember(e, headers)))]); | ||
|
|
||
| // Group featured members by year, newest first | ||
| const grouped = featuredRaw.filter(Boolean).reduce((acc, item) => { | ||
| (acc[item.year] ||= []).push(item); | ||
| return acc; | ||
| }, {}); | ||
|
|
||
| const featured = Object.keys(grouped) | ||
| .sort((a, b) => Number(b) - Number(a)) | ||
| .map((year) => ({ year: Number(year), members: grouped[year] })); | ||
|
|
||
| return { featured, contributors }; | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { fetchHallOfFameData } from "../../lib/hallOfFame.js"; | ||
|
|
||
| export default function hallOfFamePlugin() { | ||
| return { | ||
| name: "hall-of-fame", | ||
|
|
||
| async loadContent() { | ||
| const token = process.env.GITHUB_TOKEN; | ||
|
|
||
| return await fetchHallOfFameData({ token }); | ||
| }, | ||
|
|
||
| async contentLoaded({ content, actions }) { | ||
| actions.setGlobalData(content); | ||
| }, | ||
| }; | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| [ | ||
| { | ||
| "username": "08abhinav", | ||
| "year": 2026, | ||
| "blurb": "Built this page" | ||
| }, | ||
| { | ||
| "username": "siddharth1407", | ||
| "year": 2026, | ||
| "blurb": "Built a reusable WebGPU helper layer, ported both kernels to it, and documented gpu_utils" | ||
| }, | ||
| { | ||
| "username": "hjmillard", | ||
| "year": 2025, | ||
| "blurb": "Wrote the original K-means and thresholding utilities and later split K-means into its own module" | ||
| }, | ||
| { | ||
| "username": "fransafu", | ||
| "year": 2025, | ||
| "blurb": "Collaborated with @Krasner on the first implementation of the bilateral filter" | ||
| }, | ||
| { | ||
| "username": "krasner", | ||
| "year": 2025, | ||
| "blurb": "Turned Img2Num into what it is today" | ||
| }, | ||
| { | ||
| "username": "Prachi-Gupta2808", | ||
| "year": 2026, | ||
| "blurb": "Did a lot...★★★" | ||
| }, | ||
| { | ||
| "username": "dougwithseismic", | ||
| "year": "2025", | ||
| "blurb": "Set up the Vitest unit-testing infrastructure and co-authored the Docker/CMake cross-platform build" | ||
| }, | ||
| { | ||
| "username": "Ryan-Millard", | ||
| "year": 2025, | ||
| "blurb": "Did nothing" | ||
| } | ||
|
Ryan-Millard marked this conversation as resolved.
|
||
| ] | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.