Skip to content

Commit a9061b4

Browse files
committed
Fix profile matching
1 parent c6246f0 commit a9061b4

1 file changed

Lines changed: 47 additions & 1 deletion

File tree

docs/js/github-profiles.js

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
// GitHub handles mapping for team members
2+
const GITHUB_PROFILES = {
3+
"Test": "test"
4+
// Add more team members here in the format "Full Name": "github-username"
5+
};
6+
17
// Function to get GitHub username by person's name
28
function getGitHubUsername(fullName) {
39
return GITHUB_PROFILES[fullName] || null;
@@ -58,9 +64,13 @@ document.addEventListener('DOMContentLoaded', function() {
5864
// Insert card after the handle
5965
handle.parentNode.insertBefore(cardContainer, handle.nextSibling);
6066

61-
// Fetch GitHub profile data
67+
// Fetch GitHub profile data - add error handling for rate limits
6268
fetch(`https://api.github.com/users/${username}`)
6369
.then(response => {
70+
if (response.status === 403) {
71+
// Likely a rate limit issue
72+
throw new Error('GitHub API rate limit exceeded. Please try again later.');
73+
}
6474
if (!response.ok) {
6575
throw new Error('GitHub profile not found');
6676
}
@@ -90,6 +100,42 @@ document.addEventListener('DOMContentLoaded', function() {
90100
});
91101
};
92102

103+
// Add CSS for GitHub profiles
104+
const style = document.createElement('style');
105+
style.textContent = `
106+
.github-profile-card {
107+
margin: 10px 0;
108+
}
109+
.profile-card {
110+
display: flex;
111+
border: 1px solid #e1e4e8;
112+
border-radius: 6px;
113+
padding: 10px;
114+
background-color: #f6f8fa;
115+
max-width: 400px;
116+
}
117+
.profile-image img {
118+
width: 50px;
119+
height: 50px;
120+
border-radius: 50%;
121+
margin-right: 10px;
122+
}
123+
.profile-info h4 {
124+
margin: 0 0 5px 0;
125+
}
126+
.profile-info .bio {
127+
margin: 0;
128+
font-size: 0.9em;
129+
color: #586069;
130+
}
131+
.loading {
132+
font-style: italic;
133+
color: #586069;
134+
font-size: 0.9em;
135+
}
136+
`;
137+
document.head.appendChild(style);
138+
93139
// Run processor
94140
processGitHubHandles();
95141
});

0 commit comments

Comments
 (0)