Skip to content

Commit b6dd633

Browse files
feat: add GitHub token auth and loading progress indicator
- Add GitHub token input field to team dashboard form - Password type for security - Help text with rate limit info (60 → 5000 req/h) - Link to GitHub token creation page - Add real-time loading progress indicator - Shows current username being fetched - Displays progress count (e.g., '2 of 5') - Updates as each user is processed These enhancements improve UX and enable authenticated requests for higher rate limits when generating team reports. Related: Phase 3 enhancements for whatdidyougetdone
1 parent 5cb25ae commit b6dd633

2 files changed

Lines changed: 35 additions & 4 deletions

File tree

index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,22 @@ <h2>🎯 Create Custom Team Report</h2>
6060
<small>Enter usernames separated by commas</small>
6161
</div>
6262

63+
<div class="form-group">
64+
<label for="github-token">GitHub Token (optional):</label>
65+
<input
66+
type="password"
67+
id="github-token"
68+
name="token"
69+
placeholder="ghp_xxxxxxxxxxxxxxxxxxxx"
70+
/>
71+
<small>
72+
Increases rate limit from 60 to 5000 requests/hour.
73+
<a href="https://github.com/settings/tokens" target="_blank" rel="noopener noreferrer">
74+
Create token
75+
</a>
76+
</small>
77+
</div>
78+
6379
<div class="form-row">
6480
<div class="form-group">
6581
<label for="team-days">Days to look back:</label>

script.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ function setupTeamDashboard() {
336336
const days = parseInt(document.getElementById('team-days').value);
337337
const startDate = document.getElementById('team-start-date').value;
338338
const endDate = document.getElementById('team-end-date').value;
339+
const token = document.getElementById('github-token').value.trim() || null;
339340

340341
if (usernames.length === 0) {
341342
alert('Please enter at least one GitHub username');
@@ -356,7 +357,7 @@ function setupTeamDashboard() {
356357

357358
// Generate team report using GitHub API
358359
try {
359-
const report = await generateTeamReport(usernames, days, startDate, endDate);
360+
const report = await generateTeamReport(usernames, days, startDate, endDate, token);
360361
const html = marked.parse(report);
361362
resultContent.innerHTML = html;
362363
} catch (error) {
@@ -412,7 +413,7 @@ async function fetchGitHubEvents(username, token = null) {
412413
return await response.json();
413414
}
414415

415-
async function generateTeamReport(usernames, days, startDate, endDate) {
416+
async function generateTeamReport(usernames, days, startDate, endDate, token = null) {
416417
// Calculate date range
417418
const now = new Date();
418419
const start = startDate ? new Date(startDate) : new Date(now.getTime() - days * 24 * 60 * 60 * 1000);
@@ -422,9 +423,23 @@ async function generateTeamReport(usernames, days, startDate, endDate) {
422423
const allEvents = [];
423424
const errors = [];
424425

425-
for (const username of usernames) {
426+
for (let i = 0; i < usernames.length; i++) {
427+
const username = usernames[i];
428+
429+
// Update progress indicator
430+
const resultContent = document.getElementById('team-content');
431+
resultContent.innerHTML = `
432+
<div style="text-align: center; padding: 2rem;">
433+
<div class="spinner"></div>
434+
<p>Generating team report...</p>
435+
<p style="color: var(--text-secondary); margin-top: 1rem;">
436+
Fetching activity for <strong>${username}</strong> (${i + 1}/${usernames.length})
437+
</p>
438+
</div>
439+
`;
440+
426441
try {
427-
const events = await fetchGitHubEvents(username);
442+
const events = await fetchGitHubEvents(username, token);
428443
allEvents.push({ username, events });
429444
} catch (error) {
430445
errors.push({ username, error: error.message });

0 commit comments

Comments
 (0)